Re: help with limiting query results

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: help with limiting query results
Дата
Msg-id 20559.1074488086@sss.pgh.pa.us
обсуждение исходный текст
Ответ на help with limiting query results  ("OizOne" <rautaon@nic.fi>)
Список pgsql-sql
"OizOne" <rautaon@nic.fi> writes:
> I would need to create a query that selects each hostname only once with
> username that has the latest timestamp in the logontime column.

SELECT DISTINCT ON is a convenient way to do this.  See the "weather
reports" example in the SELECT reference page for a similar case.
        regards, tom lane


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

Предыдущее
От: Robert Creager
Дата:
Сообщение: How can I get the last element out of GROUP BY sets?
Следующее
От: "Denis"
Дата:
Сообщение: Re: Left joins with multiple tables