Join required??

From: Timo Tuomi <tt(at)sllpilots(dot)fi>
To: pgsql-novice(at)postgresql(dot)org
Subject: Join required??
Date: 2001-03-18 11:43:06
Message-ID: Pine.LNX.4.04.10103181338110.8635-100000@hangar.keskiespoo.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

testdb=>
testdb=> select * from test1;

c|i
-+-
A|2
B|3
C|4
(3 rows)

testdb=> select * from test2;

c|i
-+-
A|6
C|7
(2 rows)

testdb=>

I'd like to get (test1.i + test2.i) like this:

c|sum
-+---
A|8
B|3
C|11

i.e. to sum the rows but if one of the rows doesn't exist on one of the tables
then print just the existing row. How can I do this with postgresql-6.5.3?

Thanks in advance,
Timo T.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2001-03-18 12:10:00 Re: Join required??
Previous Message Timo Tuomi 2001-03-17 21:19:06 Help with a query, please