pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sylfanie@club-internet.fr
To: pgsql-sql@postgresql.org
Subject: Difficult query (for me)
Date: 4 Apr 2003 12:06:22 -0800
Message-ID: <4ff986f9.0304041206.1ae7b97a@posting.google.com> (raw)

Hello,

Basicaly I have two tables like this:

Table 1
RecordName Value
a          100
b          100
c          100
d          100
e          100
f          100

Table 2
RecordName Value
a         25
b         50
c         75
g         150
h         150

I would like a query that give me a result like this:
a         75 (100-25)
b         50 (100-50)
c         25
d         100
e         100
f         100
g         -150
h         -150

It is table1-table2. 
I could do it for records a,b,c but I do not how to have record which
are only in one of the two tables.
Thanks for your help.
Stephane.




view thread (7+ messages)  latest in thread

Message-ID: <4ff986f9.0304041206.1ae7b97a@posting.google.com>
Permalink:  ../4ff986f9.0304041206.1ae7b97a@posting.google.com/
Also on:    postgresql.org/message-id/4ff986f9.0304041206.1ae7b97a@posting.google.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sylfanie@club-internet.fr
  Subject: Re: Difficult query (for me)
  In-Reply-To: <4ff986f9.0304041206.1ae7b97a@posting.google.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