pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Louis-David Mitterrand <cunctator@apartia.ch>
To: Josh Berkus <josh@agliodbs.com>
Cc: sqllist <pgsql-sql@postgresql.org>
Subject: Re: sum of agreggates in one SELECT?
Date: Tue, 19 Sep 2000 22:06:57 +0200
Message-ID: <20000919220657.E557@styx> (raw)
In-Reply-To: <39C7AB0E.FA901CF8@agliodbs.com>
References: <20000919125859.A2802@styx>
	<7125.969384468@sss.pgh.pa.us>
	<39C7AB0E.FA901CF8@agliodbs.com>

On Tue, Sep 19, 2000 at 11:06:06AM -0700, Josh Berkus wrote:
> 
> Unfortunately, Louis-David, I don't see any way around subselects in the
> FROM clause as Tom mentions, which are not currently supported.  I'd
> suggest using a Function to create a temporary table or view and
> summarizing from that.

I did create a pl/pgsql function in the end, to compute my total:

			FOR bid IN SELECT max(b.lot) AS price
                FROM bid b WHERE b.auction_id = $1 GROUP BY b.person_id 
                LOOP
                i := i + bid.price;
            END LOOP;
            RETURN i;

Thanks for your input,

-- 
Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.org

"Faith strikes me as intellectual laziness." -- Robert A. Heinlein



view thread (6+ messages)  latest in thread

Message-ID: <20000919220657.E557@styx>
Permalink:  ../20000919220657.E557@styx/
Also on:    postgresql.org/message-id/20000919220657.E557@styx

 · 

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: cunctator@apartia.ch, josh@agliodbs.com
  Subject: Re: sum of agreggates in one SELECT?
  In-Reply-To: <20000919220657.E557@styx>
  References: <20000919125859.A2802@styx> <7125.969384468@sss.pgh.pa.us> <39C7AB0E.FA901CF8@agliodbs.com> <20000919220657.E557@styx>

* 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