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

From Alex Pilosov
Subject Re: finding a maximum or minimum sum
Date
Msg-id Pine.BSO.4.10.10106111348530.16686-100000@spider.pilosoft.com
Whole thread Raw
In response to finding a maximum or minimum sum  ("Michael Richards" <michael@fastmail.ca>)
List pgsql-sql
On Mon, 11 Jun 2001, Michael Richards wrote:

> I run a select sum(amount) from payments group by userid
> userid | sum
> --------------
>   1    | $500
>   2    | $310
>   3    |  $20
> 

> I need to modify this query so it returns the minimum, maximum and 
> average sums. Is there any way I can do this?
select sum(amount),min(amount),max(amount) from payments group by userid

Is that what you mean? Or you want min/max _not_ to be grouped by userid?



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Table design issue....
Next
From: pierre@kahuna.versions.com
Date:
Subject: Re: Table design issue....