aggregate functions in "SELECT"

Поиск
Список
Период
Сортировка
От Gerald Cheves
Тема aggregate functions in "SELECT"
Дата
Msg-id 529E50A7.3000702@verizon.net
обсуждение исходный текст
Ответы Re: aggregate functions in "SELECT"
Список pgsql-novice
Dear Colleagues,

How can I use the COUNT variable and the COL_YES variable to calculate a
percentage COL_YES/COUNT*100?

This operation isn't allowed in the "SELECT" statement.

Thanks


Select  g.STATE,
     g.COMPANY,
     g.MODEL,
        count(g.MODEL) as COUNT,
        coalesce(sum(case when COLORS = 'Yes' then 1 else 0 end),0) as
COL_YES
from gentech_12_13 as g
where MODEL = '0387' and COMPANY = 'ACME'
group by g.STATE, g.COMPANY, g.MODEL
;

--
siamo arrivati sani e salvi



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

Предыдущее
От: David Johnston
Дата:
Сообщение: Re: Add full object name to tag field
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: aggregate functions in "SELECT"