Need help with basic sql
Posted on
16th Feb 2014 07:03 pm by
admin
Hi,
I am using oracle 10g, and having some small doubts related to sql , here goes the situation
Did you know?Explore Trending and Topic pages for more stories like this.
I have a Transaction table , which contains records/transaction carried out by a employee under a Reason code on various dates, refer to below sample data
EMP_CODE REASON_CODE DATE
A001 B1 1st Jan 2009
A001 B1 3rd Jan 2009
A001 B1 6rd Jan 2009
A001 C2 9th Jan 2009
A002 D4 1st Jan 2009
A002 D4 3rd Jan 2009
A002 D5 6rd Jan 2009
A003 E6 6rd Jan 2009
A003 E6 7rd Jan 2009
Effectively i want to have final result as follows (i.e. some how hide A003 , refer to below for reason )
A001 B1
A001 C2
A002 D4
A002 D5
*So basically print Employee code and reason code only if employee has done transaction under more than 1 reason code, since employee code 'A003' carried out transaction ONLY under 1 UNIQUE Reason code , i dont want his record to be printed.*
the current query which i wrote is as follows :
select emp_cd, reas_cd
from employee_trans_table
where reas_cd ' '
group by emp_cd, reas_cd
order by emp_cd, reas_cd
but this prints results as
A001 B1
A001 C2
A002 D4
A002 D5
A003 E6
How do i avoid prnting A003/E6 since it had only 1 reason code attached to it..
I hope i am able to clearly state the doubt which i have, let me know if you require any further info/clarrification on this.
No comments posted yet
Your Answer:
Login to answer
193
10
Other forums
Internal class functions don't seem to get executed.
Hi. Can someone please put me out of my misery on this. I don't write much PHP and this has me baffl
upgrade from 4.7 to ECC 6.0
Hi all,
we are going to do an upgrade from R/3 4.7 to ECC 6.0. I need to know if i can find som
a function to check directory depth
I'm working on a php script to upload files in to a set directory.
the user can select to upload
pass form variables straight to email, no database required?
hello all,
im working on this form...
http://www.adobedayevents.com/project_request/pr
Query issues
I probably have this setup wrong well I know I do because nothing is showing up now. What I want is
same querie, or a new one??
Hi guys,
I'm still working on this drop down list. I've got the actual drop down list to wor
Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.
But
Warning: session_start() headers already sent error - Driving me Nuts!
I am trying my sister in laws site and I keep getting an error with my coding. I am more of a design
Calculating a rating by adding number of points and dividing by number of items
I have a site that users can post links to files to download. They can rate these files on a 1-5 sca
ALV List Display to point to another report on Double Click
Hi,
I want my ALV List Display to point to another report on Double Click on its line ite