Livejournal
Log in
Post
Friends
My journal
liviox
SQL (SELECT DISTINCT ON)
Dec 07, 2009 13:58
Выборка уникальных значений с сортировкой по выбранному полю.
SELECT * FROM (
SELECT DISTINCT ON (field1) field1, time_field FROM table
) as tbl
ORDER BY time_field DESC
sql
Leave a comment
Previous post
Next post
Up