Received: from www.arcamax.com (arcamax.com [209.96.210.66]) by hub.org (8.10.1/8.10.1) with ESMTP id e5QGbA177302 for ; Mon, 26 Jun 2000 12:37:10 -0400 (EDT) Received: from bryan2 (bryan [209.96.210.45]) by www.arcamax.com (8.9.3/8.9.3) with SMTP id MAA12754 for ; Mon, 26 Jun 2000 12:37:09 -0400 Message-ID: <000b01bfdf8c$aef88000$2dd260d1@arcamax.com> From: "Bryan White" To: "pgsql-sql" Subject: A subselect in an aggregate Date: Mon, 26 Jun 2000 12:36:31 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Archive-Number: 200006/227 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?