Skip site navigation (1) Skip section navigation (2)

Re: adding fields containing NULL values

From: Grant Finnemore <gaf(at)ucs(dot)co(dot)za>
To: pgsql-sql(at)postgresql(dot)org
Cc: Werner Modenbach <modenbach(at)alc(dot)de>
Subject: Re: adding fields containing NULL values
Date: 2000-05-29 13:43:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql

> Umfortunately 'select employee,date,sallary+extras as total' doesn't give the
> desired result because 'somevalue + NULL' is considered to be NULL.
> Is there any solution for my (small) problem?

    SELECT employee, date, salary + COALESCE(extras, 0) as total FROM ...



> Poorly planned software requires a genius to write it
> and a hero to use it.

Grant Finnemore BSc(Eng)  (mailto:gaf(at)ucs(dot)co(dot)za)
Software Engineer         Universal Computer Services
Tel  (+27)(11)712-1366    PO Box 31266 Braamfontein 2017, South Africa
Cell (+27)(82)604-5536    20th Floor, 209 Smit St., Braamfontein
Fax  (+27)(11)339-3421    Johannesburg, South Africa

In response to

pgsql-sql by date

Next:From: Bernie HuangDate: 2000-05-29 16:21:20
Subject: template or index of some kind
Previous:From: Werner ModenbachDate: 2000-05-29 11:58:31
Subject: adding fields containing NULL values

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group