Re: [SQL] Finding the "most recent" rows

From: Brook Milligan <brook(at)trillium(dot)NMSU(dot)Edu>
To: jas1(at)scigen(dot)co(dot)uk
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Finding the "most recent" rows
Date: 1999-04-23 14:42:55
Message-ID: 199904231442.IAA17294@trillium.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
>
> SELECT DISTINCT ON place * FROM table ORDER BY place, time DESC;
>
> might do the right thing. It *seems* to select the first row for each
> value of place. I've never seen a spec for this feature, however, so
> I'm not sure if it's reliable or not...

Cool idea. Is DISTINCT guarranteed to choose the first row that
matches or can it choose any row?

Cheers,
Brook

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Justin Long 1999-04-23 15:04:07 Large objects - bug? caveat? feature?
Previous Message Justin Long 1999-04-23 14:33:54 FW: [SQL] SELECT TOP _x_ ??