Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 7A7A79FBB44 for ; Mon, 14 May 2007 20:48:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 33000-08 for ; Mon, 14 May 2007 20:48:05 -0300 (ADT) X-Greylist: delayed 00:52:21.955088 by SQLgrey-1.7.5 Received: from outE.internet-mail-service.net (outE.internet-mail-service.net [216.240.47.228]) by postgresql.org (Postfix) with ESMTP id 948369FB859 for ; Mon, 14 May 2007 20:48:09 -0300 (ADT) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.32) with ESMTP; Mon, 14 May 2007 16:48:07 -0700 Received: from [192.168.1.109] (adsl-71-135-160-185.dsl.pltn13.pacbell.net [71.135.160.185]) by idiom.com (Postfix) with ESMTP id 2B51F125A27 for ; Mon, 14 May 2007 16:48:07 -0700 (PDT) Message-ID: <4648F536.80303@obviously.com> Date: Mon, 14 May 2007 16:48:06 -0700 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20061107 SUSE/1.1.1-0.1 SeaMonkey/1.1.1 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Doing a conditional aggregate (e.g. count(*) if x=y) in postgres? References: <4648E8F1.4020609@obviously.com> <4648EE4F.3040005@polimetrix.com> In-Reply-To: <4648EE4F.3040005@polimetrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/115 X-Sequence-Number: 28395 Ah perfect. I was struggling with CASE outside the SUM(), which was not working.