sum of two queries

From: Kyle Bateman <kyle(at)actarg(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: sum of two queries
Date: 1999-04-22 17:26:23
Message-ID: 371F5BBF.874251FD@actarg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Is there a way to return the sum of two separate queries as in:

select (select sum(price) from items) + (select sum(price) from
widgets))

select 3 + 4 works OK but the parser doesn't like sticking a subquery in
place
of the numbers.

Is there another way to do this?

kyle(at)actarg(dot)com

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael J Davis 1999-04-22 17:48:58 RE: [SQL] sum of two queries
Previous Message Tom Lane 1999-04-22 15:29:31 Re: [SQL] Finding the "most recent" rows