From: Bryan White <bryan@arcamax.com>
To: pgsql-sql <pgsql-sql@postgreSQL.org>
Subject: A subselect in an aggregate
Date: Mon, 26 Jun 2000 12:36:31 -0400
Message-ID: <000b01bfdf8c$aef88000$2dd260d1@arcamax.com> (raw)
This statement works:
select date, (select sum(qty * price) from orderdetail d where d.orderid =
orders.orderid) from orders
But when I try to do something like this:
select date, sum(select sum(qty * price) from orderdetail d where d.orderid
= orders.orderid) from orders group by date
I get ERROR: parser: parse error at or near "select"
Is there a way to apply an agregate function to a subselect like this?
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: bryan@arcamax.com
Subject: Re: A subselect in an aggregate
In-Reply-To: <000b01bfdf8c$aef88000$2dd260d1@arcamax.com>
References: <000b01bfdf8c$aef88000$2dd260d1@arcamax.com>
* 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