Re: finding a maximum or minimum sum

Поиск
Список
Период
Сортировка
От Michael Richards
Тема Re: finding a maximum or minimum sum
Дата
Msg-id 3B251601.000107.67770@frodo.searchcanada.ca
обсуждение исходный текст
Ответ на finding a maximum or minimum sum  ("Michael Richards" <michael@fastmail.ca>)
Список pgsql-sql
Puuuurfect! This is exactly what I needed. Didn't know postgres 
supported subselects like that. Thanks.

-Michael

> select min(amtsum), max(amtsum), avg(amtsum)
> from (select sum(amount) as amtsum from payments group by userid)
> ss;
>
> In prior versions you'd need to do the initial select into a temp
> table and then select min/max/avg from that.

_________________________________________________________________    http://fastmail.ca/ - Fast Free Web Email for
Canadians

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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: Table design issue....
Следующее
От: David Olbersen
Дата:
Сообщение: Re: ORDER BY what?