Re: [SQL] Finding the "most recent" rows - Mailing list pgsql-sql

From Chris Bitmead
Subject Re: [SQL] Finding the "most recent" rows
Date
Msg-id 37286C86.8E0472A6@bigfoot.com
Whole thread Raw
In response to Re: [SQL] Finding the "most recent" rows  (Brook Milligan <brook@trillium.NMSU.Edu>)
Responses Re: [SQL] Finding the "most recent" rows
List pgsql-sql
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


pgsql-sql by date:

Previous
From: José Soares
Date:
Subject: Re: [SQL] LIMIT
Next
From: Herouth Maoz
Date:
Subject: Re: [SQL] Finding the "most recent" rows