Re: sum of agreggates in one SELECT?

From: Louis-David Mitterrand <cunctator(at)apartia(dot)ch>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: sqllist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: sum of agreggates in one SELECT?
Date: 2000-09-19 20:06:57
Message-ID: 20000919220657.E557@styx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)apartia(dot)org - http://www.apartia.org

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-09-19 20:27:45 Re: Repeatable reads
Previous Message John McKown 2000-09-19 18:17:01 Re: sum of agreggates in one SELECT?