Re: multiple count functions in a select statement

Поиск
Список
Период
Сортировка
От Duane Lee - EGOVX
Тема Re: multiple count functions in a select statement
Дата
Msg-id 64EDC403A1417B4299488BAE87CA7CBF01CD0E47@maricopa_xcng0
обсуждение исходный текст
Ответ на multiple count functions in a select statement  ("Jeannie Stevenson" <webteam@wes-state.com>)
Список pgsql-general
If I understand what you're asking try:
 
select count_1, count_2 from
(select count(*) AS count_1 from leads where ad_code = '555'),
(select count(*) AS count_2 from leads where ad_code = '222')
;
 
Duane
-----Original Message-----
From: Jeannie Stevenson [mailto:webteam@wes-state.com]
Sent: Thursday, May 27, 2004 9:39 AM
To: postgresql
Subject: [GENERAL] multiple count functions in a select statement

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
 
 

В списке pgsql-general по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Problems with pgsql mail servers?
Следующее
От: Duane Lee - EGOVX
Дата:
Сообщение: Re: multiple count functions in a select statement