pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Grant Finnemore <gaf@ucs.co.za>
To: pgsql-sql@postgresql.org
Cc: Werner Modenbach <modenbach@alc.de>
Subject: Re: adding fields containing NULL values
Date: Mon, 29 May 2000 15:43:07 +0200
Message-ID: <393273EB.225F9DA5@ucs.co.za> (raw)
References: <00052913594506.02278@werner.alc.de>

Werner,

> 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?

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

Regards

Grant

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

Grant Finnemore BSc(Eng)  (mailto:gaf@ucs.co.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






view thread (2+ messages)

Message-ID: <393273EB.225F9DA5@ucs.co.za>
Permalink:  ../393273EB.225F9DA5@ucs.co.za/
Also on:    postgresql.org/message-id/393273EB.225F9DA5@ucs.co.za

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gaf@ucs.co.za, modenbach@alc.de
  Subject: Re: adding fields containing NULL values
  In-Reply-To: <393273EB.225F9DA5@ucs.co.za>
  References: <00052913594506.02278@werner.alc.de> <393273EB.225F9DA5@ucs.co.za>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox