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

Home -> Community -> Usenet -> c.d.o.server -> Re: help with SQL Select Statement

Re: help with SQL Select Statement

From: Jurij Modic <jmodic_at_src.si>
Date: Tue, 14 Sep 1999 20:08:02 GMT
Message-ID: <37e4ab05.6067065@news.arnes.si>


On Tue, 14 Sep 1999 18:36:05 GMT, smagadi_at_yahoo.com wrote:

>Hi,
>
>I have a emp table which has data as follows:
>....[SNIP]....
>
>As shown in the example above if there are two start dates which are
>same, it should retrive the row with the stop date.
>
>Any help would be appreciated.
>
>Thank you
>
>sashi

The simplest (yet maybe not the fastest) way would be:

SELECT serial_no, start, stop FROM emp
WHERE serial_no IN (SELECT MAX(serial_no) FROM emp GROUP BY start);

HTH, Jurij Modic <jmodic_at_src.si>
Certified Oracle DBA (7.3 & 8.0 OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Tue Sep 14 1999 - 15:08:02 CDT

Original text of this message

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