Re: Am I crazy or is this SQL not possible

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: "Klay Martens" <kmartens(at)wol(dot)co(dot)za>
Cc: patrick(dot)jacquot(at)anpe(dot)fr, cadiolis(at)gmail(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Am I crazy or is this SQL not possible
Date: 2006-06-02 15:23:30
Message-ID: bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)wol(dot)co(dot)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.
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2006-06-02 17:43:25 Re: Advanced Query
Previous Message Klay Martens 2006-06-02 11:53:42 Re: Am I crazy or is this SQL not possible