only last records in subgroups

Поиск
Список
Период
Сортировка
От Dino Vliet
Тема only last records in subgroups
Дата
Msg-id 20040817104437.93301.qmail@web40110.mail.yahoo.com
обсуждение исходный текст
Ответы Re: only last records in subgroups  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Re: only last records in subgroups  (Greg Stark <gsstark@mit.edu>)
Список pgsql-sql
Hi there,

I'm having hard times with the following query:
I want to select only the last records from a subgroup
in a table. But because the subgroup contains
different number of records for every id, I don't know
how to specify that. For example, check the following
table,
id, day
x,300
x,250,
x,0
y,250
y,4

I only want the records
x,0 and y,4 but how do I manage this in sql? I was
hoping for a keyword LAST or so, where I can specify
that when I've ordered my results with order by, I
could only get the last of the subgroups (the first
one is easy because I could use limit 1)

Thanks in advance

    
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: multi column foreign key for implicitly unique columns
Следующее
От: Markus Bertheau
Дата:
Сообщение: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo