Received: from trillium.nmsu.edu (trillium.NMSU.Edu [128.123.5.15]) by hub.org (8.9.3/8.9.1) with ESMTP id KAA69844 for ; Fri, 23 Apr 1999 10:43:13 -0400 (EDT) (envelope-from brook@trillium.NMSU.Edu) Received: (from brook@localhost) by trillium.nmsu.edu (8.8.8/8.8.8) id IAA17294; Fri, 23 Apr 1999 08:42:55 -0600 (MDT) Date: Fri, 23 Apr 1999 08:42:55 -0600 (MDT) Message-Id: <199904231442.IAA17294@trillium.nmsu.edu> X-Authentication-Warning: trillium.nmsu.edu: brook set sender to brook@trillium.nmsu.edu using -f From: Brook Milligan To: jas1@scigen.co.uk CC: tgl@sss.pgh.pa.us, pgsql-sql@postgreSQL.org In-reply-to: <37204BB5.B6CD57B9@scigen.co.uk> (message from Julian Scarfe on Fri, 23 Apr 1999 10:30:14 +0000) Subject: Re: [SQL] Finding the "most recent" rows References: <17966.924794971@sss.pgh.pa.us> <37204BB5.B6CD57B9@scigen.co.uk> 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