Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group