X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id D6D24924E45 for ; Mon, 19 May 2003 21:13:40 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 18025-06 for ; Mon, 19 May 2003 21:13:37 -0400 (EDT) Received: from email02.aon.at (WARSL402PIP7.highway.telekom.at [195.3.96.94]) by developer.postgresql.org (Postfix) with SMTP id 873B0924EDE for ; Mon, 19 May 2003 19:53:28 -0400 (EDT) Received: (qmail 385210 invoked from network); 19 May 2003 23:53:26 -0000 Received: from m169p028.dipool.highway.telekom.at (HELO cantor) ([62.46.11.28]) (envelope-sender ) by qmail2rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 19 May 2003 23:53:26 -0000 From: Manfred Koizar To: Cc: Subject: Re: CASE Date: Tue, 20 May 2003 01:52:41 +0200 Message-ID: <6ericvkpd536s9a51atc05fsm45oib7mpf@4ax.com> References: <002201c31dd4$3f34c100$0000fea9@theplague> In-Reply-To: <002201c31dd4$3f34c100$0000fea9@theplague> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/375 X-Sequence-Number: 13540 On Sun, 18 May 2003 23:59:46 -0700, "James Taylor" 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