Re: Am I crazy or is this SQL not possible

Поиск
Список
Период
Сортировка
От Aaron Bono
Тема Re: Am I crazy or is this SQL not possible
Дата
Msg-id bf05e51c0606020823n4cf643dakccd752666000a4d6@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Am I crazy or is this SQL not possible  ("Klay Martens" <kmartens@wol.co.za>)
Список 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 по дате отправления:

Предыдущее
От: "Klay Martens"
Дата:
Сообщение: Re: Am I crazy or is this SQL not possible
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Advanced Query