Re: finding a maximum or minimum sum - Mailing list pgsql-sql

From Michael Richards
Subject Re: finding a maximum or minimum sum
Date
Msg-id 3B251601.000107.67770@frodo.searchcanada.ca
Whole thread Raw
In response to finding a maximum or minimum sum  ("Michael Richards" <michael@fastmail.ca>)
List 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 by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Table design issue....
Next
From: David Olbersen
Date:
Subject: Re: ORDER BY what?