| From: | Michael J Davis <michael(dot)j(dot)davis(at)tvguide(dot)com> | 
|---|---|
| To: | "'Kyle Bateman'" <kyle(at)actarg(dot)com>, pgsql-sql(at)postgreSQL(dot)org | 
| Subject: | RE: [SQL] sum of two queries | 
| Date: | 1999-04-22 17:48:58 | 
| Message-ID: | 93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
I use functions. For example:
Create function1 as
	'select sum(price) from items';
Create function2 as
	'select sum(price) from widgets';
select function1 + function2;
	-----Original Message-----
	From:	Kyle Bateman [SMTP:kyle(at)actarg(dot)com]
	Sent:	Thursday, April 22, 1999 11:26 AM
	To:	pgsql-sql(at)postgreSQL(dot)org
	Subject:	[SQL] sum of two queries
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kyle Bateman | 1999-04-22 18:15:01 | Re: [SQL] sum of two queries | 
| Previous Message | Kyle Bateman | 1999-04-22 17:26:23 | sum of two queries |