pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ldm@apartia.ch
Cc: pgsql-sql@postgresql.org
Subject: Re: sum of agreggates in one SELECT?
Date: Tue, 19 Sep 2000 13:27:48 -0400
Message-ID: <7125.969384468@sss.pgh.pa.us> (raw)
In-Reply-To: <20000919125859.A2802@styx>
References: <20000919125859.A2802@styx>

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



view thread (6+ messages)  latest in thread

Message-ID: <7125.969384468@sss.pgh.pa.us>
Permalink:  ../7125.969384468@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7125.969384468@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ldm@apartia.ch
  Subject: Re: sum of agreggates in one SELECT?
  In-Reply-To: <7125.969384468@sss.pgh.pa.us>
  References: <20000919125859.A2802@styx> <7125.969384468@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox