math problem - Mailing list pgsql-general

From Vincent Stoessel
Subject math problem
Date
Msg-id 3D4077BE.70506@xaymaca.com
Whole thread Raw
Responses Re: math problem  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: math problem  ("Roderick A. Anderson" <raanders@acm.org>)
List pgsql-general
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

Attachment

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: regression test
Next
From: Stephan Szabo
Date:
Subject: Re: math problem