Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Retrieving first row of a query in Oracle SQL
On Aug 30, 1:30 am, digory <dig..._at_gmx.net> wrote:
> > SELECT id, dat, cnt, stuff
> > FROM T
> > WHERE (cnt,dat) IN (
> > SELECT MIN (cnt), MIN(dat)
> > FROM T
> > WHERE dat = (
> > SELECT MIN(dat)
> > FROM T
> > )
> > )
>
> That isn't simpler either. Actually, the innermost WHERE clause is
> redundant, isn't it?
No, since you declared that the COMBINATION of the two values is unique, and the only way you'll get that is to include the min(dat) in the select list.
David Fitzjarrell Received on Thu Aug 30 2007 - 08:39:14 CDT
![]() |
![]() |