pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Werner Modenbach <modenbach@alc.de>
To: pgsql-sql@postgresql.org
Subject: adding fields containing NULL values
Date: Mon, 29 May 2000 13:58:31 +0200
Message-ID: <00052913594506.02278@werner.alc.de> (raw)

Hi all!

Let's say I have a table like:

employee  date        sallary   extras
--------------------------------------
Name1     01-31-1999  5000.00   NULL
Name1     02-29-1999  5000.00   500.00
Name1     03-31-1999  5000.00   NULL

I would like to get something like:

employee  date        total
-----------------------------
Name1     01-31-1999  5000.00
Name1     02-29-1999  5500.00
Name1     03-31-1999  5000.00

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?

- Werner -

BTW: I'm running PostgreSQL V 6.5.1

-- 
---------------------------------------
Werner Modenbach		 modenbach@alc.de
ALC Computertechnik GmbH	 http://www.alc.de



view thread (2+ messages)  latest in thread

Message-ID: <00052913594506.02278@werner.alc.de>
Permalink:  ../00052913594506.02278@werner.alc.de/
Also on:    postgresql.org/message-id/00052913594506.02278@werner.alc.de

 · 

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: modenbach@alc.de
  Subject: Re: adding fields containing NULL values
  In-Reply-To: <00052913594506.02278@werner.alc.de>
  References: <00052913594506.02278@werner.alc.de>

* 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