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 -> Re: Retrieving first row of a query in Oracle SQL

Re: Retrieving first row of a query in Oracle SQL

From: <fitzjarrell_at_cox.net>
Date: Thu, 30 Aug 2007 06:39:14 -0700
Message-ID: <1188481154.115219.73200@y42g2000hsy.googlegroups.com>


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

Original text of this message

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