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

From Michael Richards
Subject finding a maximum or minimum sum
Date
Msg-id 3B24F48D.000035.19989@frodo.searchcanada.ca
Whole thread Raw
Responses Re: finding a maximum or minimum sum
Re: finding a maximum or minimum sum
List pgsql-sql
I have a table that looks like so:
userid | amount
---------------  1   |  $500  2   |  $400  2   | $-100  2   |   $10  3   |   $10  3   |   $10

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?

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

pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Hidden Select
Next
From: "Josh Berkus"
Date:
Subject: Re: problem with Pl/Pgsql function