Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Help with query
I am going to attempt to simplify what is required which might even hel
me get my head around this:
Simplified table giving only columns that matter:
ID (Varchar2)
Year (Varchar2) Code (varchar2) Date (Date)
OK, here is what I need:
I need to
SELECT id FROM TABLE
WHERE year = '2007'
AND
This is where sql ends and elongated description begins:
Each id can have several rows, each with eiher different 'code' or 'action' or 'date' as in example below:
ID-------Year--------Code------Date-------Action
1 2007 1234 1/1/07 A 1 2007 1234 1/2/07 B 1 2007 1234 1/3/07 C 1 2007 4321 1/6/07 A 1 2007 4321 1/7/07 C 1 2007 4321 1/8/07 B
What I am looking for is:
I want to identify where ACTION C occurs before Action B where the code is the same, in the example above only line 5 would satisfy that criteria since ID is the same, year is 2007 code was the same and the action C occured on a date before action B
Thanks in advance... Received on Tue Jan 23 2007 - 16:10:11 CST
![]() |
![]() |