multiple counts using CASE
От
Johnson, Shaunn
Тема
multiple counts using CASE
Дата
Msg-id
73309C2FDD95D11192E60008C7B1D5BB0452E0F4@snt452.corp.bcbsm.com
Список
Дерево обсуждения
Re: multiple counts using CASE "Johnson, Shaunn" <SJohnson6@bcbsm.com>
Howdy
Running Postgres 7.1.3 on RedHat Linux 7.2 kernel
2.4.7 - 10.
Wonder if it is possible to get multiple counts
from ONE query using the CASE statement.
I'm trying to set something up like this:
select count (*)
case
when logic = '1' then 'First'
when logic = '2' then 'Second'
when logic = '3' then 'Third'
else 'Error'
end as 'Count'
from temp_table
;
I wonder if this is even possible? Maybe I can
try to create a variable (place holder) and
loop? I don't want to have to create many
versions of one program to count for each "logic"
in the table.
Suggestions?
Thanks!
-X
В списке pgsql-general по дате отправления