Re: sum of agreggates in one SELECT? - Mailing list pgsql-sql

From Tom Lane
Subject Re: sum of agreggates in one SELECT?
Date
Msg-id 7125.969384468@sss.pgh.pa.us
Whole thread Raw
In response to sum of agreggates in one SELECT?  (Louis-David Mitterrand <cunctator@apartia.ch>)
List pgsql-sql
Louis-David Mitterrand <cunctator@apartia.ch> writes:
> Now I would like to sum() all results from the quantity column and
> return it with one SELECT statement. Is that possible?

You can't have aggregates of aggregates in a single SELECT structure;
that's just not in the SQL execution model.  The way around this is
to write multiple levels of SELECT, using either selection from a
grouped/aggregated view or subselect-in-FROM.  Unfortunately Postgres
doesn't have either of those features --- yet.  They might be in 7.1
if I spend less time answering email and more time coding...
        regards, tom lane


pgsql-sql by date:

Previous
From: "Stuart Foster"
Date:
Subject: RE: sum of agreggates in one SELECT?
Next
From: "Michael Richards"
Date:
Subject: Repeatable reads