Re: I can not add up columns when using a left outer join. Any ideas as to why?

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: I can not add up columns when using a left outer join. Any ideas as to why?
Дата
Msg-id 5785.98059.qm@web31806.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на I can not add up columns when using a left outer join. Any ideas as to why?  ("Robert Balzli Jr" <robert.balzli@xilinx.com>)
Список pgsql-general
> COALESCE works great! Is there a way to default the LEFT JOIN to return
> zero and not NULL? Then we could use COALESCE on strings only. Most of
> our columns are integers not strings. This would make our queries
> simpler for 99% of the columns.
> Thanks,
> Robert Balzli
>
> PS: I will join the pgsql-general users group today...

No.  you will need to have:

select a, b, coalesce(a,0) + coalesce(b,0)
from your table;

Regards,

Richard Broersma Jr.

PS:
Also, don't forget to use reply all so that everyone one on the list can participate.


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

Предыдущее
От: "Ed L."
Дата:
Сообщение: DROP INDEX performance/locking
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: [HACKERS] Index greater than 8k