Re: Select most recent record?
От | Andrew Perrin |
---|---|
Тема | Re: Select most recent record? |
Дата | |
Msg-id | 3B02920A.B6340FC1@unc.edu обсуждение исходный текст |
Ответ на | Select most recent record? ("Marc Sherman" <msherman@projectile.ca>) |
Ответы |
Re: Select most recent record?
|
Список | pgsql-sql |
Except that he wants max(timestamp) by id; perhaps a GROUP BY would help, something like (untested): select max(timestamp) from log group by id; Tom Lane wrote: > > "Marc Sherman" <msherman@projectile.ca> writes: > > I'd like to select the newest (max(timestamp)) row for each id, > > before a given cutoff date; is this possible? > > select * from log order by timestamp desc limit 1; > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- -------------------------------------------------------------- Andrew J. Perrin - Programmer/Analyst, Desktop Support Children's Primary Care Research Group, UNC - Chapel Hill (919)966-9394 * andrew_perrin@unc.edu
В списке pgsql-sql по дате отправления: