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?
- Re: [SQL] A subselect in an aggregate Bryan White
- Re: [SQL] A subselect in an aggregate Ed Loehr
- Re: [SQL] A subselect in an aggregate Bryan White