Re: Single Table Select With Aggregate Function

Поиск
Список
Период
Сортировка
Искать
От
Rich Shepard
Тема
Re: Single Table Select With Aggregate Function
Дата
Msg-id
alpine.LNX.2.00.1201031605390.18032@salmo.appl-ecosys.com
Ответ на
Список
Дерево обсуждения
Single Table Select With Aggregate Function Rich Shepard <rshepard@appl-ecosys.com>
Re: Single Table Select With Aggregate Function "David Johnston" <polobo@yahoo.com>
Re: Single Table Select With Aggregate Function Tom Lane <tgl@sss.pgh.pa.us>
Re: Single Table Select With Aggregate Function Rich Shepard <rshepard@appl-ecosys.com>
Re: Single Table Select With Aggregate Function Ondrej Ivanič <ondrej.ivanic@gmail.com>
Re: Single Table Select With Aggregate Function Rich Shepard <rshepard@appl-ecosys.com>
On Tue, 3 Jan 2012, Tom Lane wrote:

> You can do that type of thing using subqueries, eg
>
> 	select ... from mytab
> 	  where col = (select max(col) from mytab where ...)

   Thanks, Tom. That's what I thought I needed.

> or if you don't mind a nonstandard construct, consider SELECT DISTINCT ON.
> There's an example of how to use that in the SELECT reference page
> (look for the weather-reports example).  In any case you're going to
> have to consider what you want to have happen when there are multiple
> occurrences of the maximum value.

   I'll look at that, too.

Much appreciated,

Rich
В списке pgsql-general по дате отправления
От: David Johnston
Дата:
От: Rich Shepard
Дата:
FAQ