Re: Am I crazy or is this SQL not possible - Mailing list pgsql-sql

From Aaron Bono
Subject Re: Am I crazy or is this SQL not possible
Date
Msg-id bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com
Whole thread Raw
In response to Re: Am I crazy or is this SQL not possible  ("Klay Martens" <kmartens@wol.co.za>)
List pgsql-sql
Only if you assume that ordering by unique_id and by date_sent are equivalent.  That may be the case but I personally hate making assumptions like that.  When someone goes into the database and updates records (clean up bad data, etc.) your perfectly running query can suddenly produce bad results.

-Aaron

On 6/2/06, Klay Martens <kmartens@wol.co.za> wrote:

Sorry to stick my nose in here...
would not this work better?

SELECT broadcast_id,date_sent,status from broadcast_history where
unique_id in (
SELECT max(unique_id) from broadcast_history group by broadcast_id);

Seems like a simpler option.

 

pgsql-sql by date:

Previous
From: "Klay Martens"
Date:
Subject: Re: Am I crazy or is this SQL not possible
Next
From: Michael Fuhr
Date:
Subject: Re: Advanced Query