Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id D2EDD9FB3F4 for ; Tue, 26 Jun 2007 07:47:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 08739-04 for ; Tue, 26 Jun 2007 07:47:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 2708A9FB37C for ; Tue, 26 Jun 2007 07:47:45 -0300 (ADT) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 15BCD75B96; Tue, 26 Jun 2007 11:45:22 +0100 (BST) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id F0C99274121; Tue, 26 Jun 2007 11:45:21 +0100 (BST) Message-ID: <4680EE41.3020200@archonet.com> Date: Tue, 26 Jun 2007 11:45:21 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Michael Landin Hostbaek , "A. Kretschmer" , pgsql-sql@postgresql.org Subject: Re: Where clause References: <20070626082405.GA67974@mich2.itxmarket.com> <20070626090140.GB28610@a-kretschmer.de> <20070626094453.GH67974@mich2.itxmarket.com> In-Reply-To: <20070626094453.GH67974@mich2.itxmarket.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/217 X-Sequence-Number: 28707 Michael Landin Hostbaek wrote: > A. Kretschmer (andreas.kretschmer) writes: >> *untested* >> >> select cid, sum(case when click = true then 1 else 0 end), sum(case when >> view = true then 1 else 0 end) from ... >> > > Thanks, but I need the DISTINCT contactid - I don't want the same > contactid counted twice. ... GROUP BY cid -- Richard Huxton Archonet Ltd