math problem

Поиск
Список
Период
Сортировка
Искать
От
Vincent Stoessel
Тема
math problem
Дата
Msg-id
3D4077BE.70506@xaymaca.com
Список
Дерево обсуждения
Re: math problem Vincent Stoessel <vincent@xaymaca.com>
Re: math problem "Roderick A. Anderson" <raanders@acm.org>
Hello All,


I need to find a workaround for my addition problem.

I have a list of values in 3 columns derived from a  left join
where the last column is the sum of the 2 on the left.

i.e.

select cola, colb, sum(cola + colb) from ....

cola  colb total
2     3    5
2     2    4





now my problem comes into play when one of the
columns is empty. I always get a NULL or empty total.
this makes sence since NULL + 5 does not produce anything.


cola colb total

      3
1
4

etc.



Any work around for this, do I have to use a
Pg language? I guess I could write a script in perl
to take of this for me but I would like to tap
the brains here to see it can al be done in the
SQL.
Thanks








-- 
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com
В списке pgsql-general по дате отправления
От: Andrew Sullivan
Дата:
Сообщение: Re: regression test
От: Stephan Szabo
Дата:
Сообщение: Re: math problem
FAQ