Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Help with query

Help with query

From: AZNewsh <gn_at_dana.ucc.nau.edu>
Date: 23 Jan 2007 14:10:11 -0800
Message-ID: <1169590211.468782.179450@h3g2000cwc.googlegroups.com>


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)

Action (Varchar2)

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US