I'm getting my feet wet using PostgreSQL and have run in to a bit of a
snag with using the + operator.
I want to create a table that has a third column that is the sum of the
values of two other columns. In essence:
SELECT a.qty AS aa,
b.qty AS bb,
a.qty + b.qty AS cc
FROM ...
The FROM is a subquery that includes a number of full joins, so there
are occasions when a.qty or b.qty are NULL.
The select statement seems to work just fine, except that where a.qty
or b.qty are NULL, cc is also NULL. (I can see how this might not work,
PostgreSQL protesting, "Okay, you want me to add this and ... and ...
and what, exactly?" But maybe I've misconceived what the problem is.)
I've googled for "postgresql mathematical operator null argument",
taken a gander at the html help files included with the PostgreSQL
installation and through Practical PostgreSQL in the sections on
mathematical operators, but didn't find anything that mentions this.
I'm probably not looking in the right places.
If someone point me in the direction I should look, I'd really
appreciate it.
Thanks for your time!
Michael Glaesemann
grzm myrealbox com