Re: sum of agreggates in one SELECT?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ldm(at)apartia(dot)ch
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: sum of agreggates in one SELECT?
Date: 2000-09-19 17:27:48
Message-ID: 7125.969384468@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Louis-David Mitterrand <cunctator(at)apartia(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Richards 2000-09-19 17:48:23 Repeatable reads
Previous Message Stuart Foster 2000-09-19 15:28:27 RE: sum of agreggates in one SELECT?