pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manfred Koizar <mkoi-pg@aon.at>
To: jtx@hatesville.com
Cc: pgsql-sql@postgresql.org
Subject: Re: CASE
Date: Tue, 20 May 2003 01:52:41 +0200
Message-ID: <6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com> (raw)
In-Reply-To: <002201c31dd4$3f34c100$0000fea9@theplague>
References: <002201c31dd4$3f34c100$0000fea9@theplague>

On Sun, 18 May 2003 23:59:46 -0700, "James Taylor"
<jtx@hatesville.com> wrote:
>select case(sum(numbers)) when null then 0 else sum(numbers) end from
>list_results;
>
>That... Doesn't work.

SELECT CASE WHEN SUM(numbers) IS NULL THEN 0 ELSE SUM(numbers) END ...

or

SELECT COALESCE(SUM(numbers), 0) FROM ...

Servus
 Manfred



view thread (20+ messages)  latest in thread

Message-ID: <6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com>
Permalink:  ../6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com/
Also on:    postgresql.org/message-id/6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mkoi-pg@aon.at, jtx@hatesville.com
  Subject: Re: CASE
  In-Reply-To: <6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com>

* 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