Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: help with SQL Select Statement
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)
![]() |
![]() |