pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael J Davis <michael.j.davis@tvguide.com>
To: 'Kyle Bateman' <kyle@actarg.com>
To: pgsql-sql@postgreSQL.org
Subject: RE: [SQL] sum of two queries
Date: Thu, 22 Apr 1999 12:48:58 -0500
Message-ID: <93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com> (raw)

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@actarg.com]
	Sent:	Thursday, April 22, 1999 11:26 AM
	To:	pgsql-sql@postgreSQL.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@actarg.com

	



view thread (4+ messages)  latest in thread

Message-ID: <93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com>
Permalink:  ../93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com/
Also on:    postgresql.org/message-id/93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: michael.j.davis@tvguide.com, kyle@actarg.com
  Subject: Re: [SQL] sum of two queries
  In-Reply-To: <93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com>
  References: <93C04F1F5173D211A27900105AA8FCFC14540E@lambic.prevuenet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox