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
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
how to load php class from another domain?
how to load php class from another domain?
need help with date function
i have following form for date
Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Pulling out some result data from MYSQL
Hey Guys,
I've built a PHP page that has a for just imagine something like registration form
Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot
Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne
need help to creat database
Hello Team, please guys i am stuck from three days with paypal issue for IPN but no luck yet now i w
Javascript using window.location seems to lose state
Not sure what forum so let me know if I'm in the wrong place.
I have a main window with a ajax grid
Execure stored procedure on a timer
Can someone tell me an easier way to execute a stored procedure on a timer? I am using Oracle 10g R
PHP template help
Ok, I don't know if anyone can help me but I am using PHP templates to make a site. I am a newbie an
PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a