-
Sql query question
Hi - I'm having a problem selecting unique data from a Single DB2 table. (I'm running AQT to run the query)
I'll try to make this a cut down version of the table.
TABLE_A
ID..................SEQ_NBR......TRAN_TYPE
111.....................1..................NBIS
111.....................2..................CACA
222.....................1..................NBIS
222.....................2..................CACA
222.....................3..................AUDIT
333.....................1..................NBIS
333.....................2..................PCNM
333.....................3..................CACA
I want to be able to select all DISTINCT ID's from TABLE_A, using the MAX(SEQ_NBR) for each ID, where TRAN_TYPE = 'CACA'
My expected result would be
111
333
Some sort of correlation is needed. Hope someone will be able to help out with this - Thanks
-
You have CACA for ID 222 as well, why is it not in expected resultset?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|