multiple count functions in a select statement

From: "Jeannie Stevenson" <webteam(at)wes-state(dot)com>
To: "postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: multiple count functions in a select statement
Date: 2004-05-27 16:38:43
Message-ID: 000b01c44409$13744d40$0800000a@jeannie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello list

I'm a MSSQL convert and I'm running postgresql 7.2

I'm trying to create a statement in which display multiple counts on a table

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

I've searched the docs but to avail.

Any help, suggestions, pointers, would be appreciated

Thanks

Jeannie

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2004-05-27 16:55:13 Re: I want to use postresql for this app, but...
Previous Message BARTKO Zoltan 2004-05-27 16:26:53 custom error messages/numbers