Received: from tech.com.au (IDENT:root@techpt.lnk.telstra.net [139.130.75.122]) by hub.org (8.9.3/8.9.1) with ESMTP id KAA80101 for ; Thu, 29 Apr 1999 10:28:18 -0400 (EDT) (envelope-from chris.bitmead@bigfoot.com) Received: from bigfoot.com (chris@localhost [127.0.0.1]) by tech.com.au (8.8.7/8.8.7) with ESMTP id AAA04957 for ; Fri, 30 Apr 1999 00:28:22 +1000 Sender: chris@tech.com.au Message-ID: <37286C86.8E0472A6@bigfoot.com> Date: Thu, 29 Apr 1999 14:28:22 +0000 From: Chris Bitmead X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgreSQL.org Subject: Re: [SQL] Finding the "most recent" rows References: Your message of Fri, 23 Apr 1999 08:42:55 -0600 (MDT) <199904231442.IAA17294@trillium.nmsu.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Herouth Maoz wrote: > Tables are considered as unordered sets. There can not be anything in the > standard that relies on the order in the table. And what do you mean by > inserting a preceding ORDER BY step? He was suggesting that an ORDER BY combined with a DISTINCT might be a good way of solving the difficult problem of finding the, say, max(field) in different groups in the table. (And it does work for postgresql) Like a SELECT ...GROUP BY except getting back not just the group fields but all fields. You say that a table is "considered an unordered set". But surely a table is not an unordered set if you've specified an ORDER BY clause? This idea is so nice, it would be ashame to dismiss it too quickly. -- Chris Bitmead http://www.bigfoot.com/~chris.bitmead mailto:chris.bitmead@bigfoot.com