Re: CASE

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: <jtx(at)hatesville(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: CASE
Date: 2003-05-19 23:52:41
Message-ID: 6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, 18 May 2003 23:59:46 -0700, "James Taylor"
<jtx(at)hatesville(dot)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

In response to

  • CASE at 2003-05-19 06:59:46 from James Taylor

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-05-20 00:17:30 Re: CASE
Previous Message Rod Taylor 2003-05-19 23:24:49 Re: CASE