Re: multiple count functions in a select statement - Mailing list pgsql-general

From Oliver Elphick
Subject Re: multiple count functions in a select statement
Date
Msg-id 1086035561.27765.89.camel@linda
Whole thread Raw
In response to multiple count functions in a select statement  ("Jeannie Stevenson" <webteam@wes-state.com>)
Responses Re: multiple count functions in a select statement  (Mike Rylander <miker@purplefrog.com>)
List pgsql-general
On Thu, 2004-05-27 at 17:38, Jeannie Stevenson wrote:
...
> In MSSQL I would use
>
> select
> count_1=(select count(ad_code) AS "CP" from leads where ad_code =
> '555'),
> count_2=(select count(ad_code) AS HED" from leads where ad_code =
> '222'),
> etc

SELECT
  (select count(ad_code) AS "CP"
     from leads where ad_code = '555') AS count_1,
  (select count(ad_code) AS HED"
     from leads where ad_code = '222') AS count_2,
...etc...

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "How precious also are thy thoughts unto me, O God! how
      great is the sum of them! If I should count them, they
      are more in number than the sand; when I awake, I am
      still with thee."    Psalms 139: 17,18


pgsql-general by date:

Previous
From: linhluong@canada.com
Date:
Subject: pg_dump question
Next
From: "Philip A. Chapman"
Date:
Subject: Re: Poatgresql database on more than one disk