Help with a query, please

Поиск
Список
Период
Сортировка
От Timo Tuomi
Тема Help with a query, please
Дата
Msg-id Pine.LNX.4.21.0103172317001.958-100000@localhost.localdomain
обсуждение исходный текст
Ответы Re: Help with a query, please  ("Oliver Elphick" <olly@lfix.co.uk>)
Список 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?

Thanks in advance,
Timo T.



В списке pgsql-novice по дате отправления:

Предыдущее
От: Lars Forseth
Дата:
Сообщение: Postgres - trouble starting the database on a suse 7.0 box - data dir not found
Следующее
От: "Oliver Elphick"
Дата:
Сообщение: Re: Help with a query, please