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
set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli
SAP Logon Failed
I tried to login to SAP through MMC.
When i click start and give password.
it
Post, not working, please help
The error is:
Method Not Allowed
The requested method POST is not allowed for the URL /student
phpMailer not working ..........
HI,
I was playing with the phpMailer script and tried to send a smiple mail using their test scri
Problem with shopcart code
Hello, I am having a bit of trouble being able to add a product to my shopcart. My mysql database i
parse error
Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on
Why does first ever HttpSendRequest take longer?
I promise this isn't as simple as it sounds. I'm wondering why the the first ever call to HttpSendRe
Looping Problem
I've got a client that has a database with about 200 events at any given time. I'm trying to loop t
Multidimensional $_POST
Hello
How to get a single array from array of array (2 - dimension).
For example I have a
Help please - How to validate from 2 possible answers
Hi
I hope somebody can help me with what will probably be really simple, I'm pulling my hair