A subselect in an aggregate - Mailing list pgsql-sql

From Bryan White
Subject A subselect in an aggregate
Date
Msg-id 000b01bfdf8c$aef88000$2dd260d1@arcamax.com
Whole thread Raw
List pgsql-sql
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?




pgsql-sql by date:

Previous
From: Kyle Bateman
Date:
Subject: finding (and recycling) holes in sequences
Next
From: Ed Loehr
Date:
Subject: Re: A subselect in an aggregate