Skip to content

Instantly share code, notes, and snippets.

@meanother
Last active October 14, 2021 19:22
Show Gist options
  • Save meanother/72aaaaa0d5e74b2ea15883ef8ce660ff to your computer and use it in GitHub Desktop.
Save meanother/72aaaaa0d5e74b2ea15883ef8ce660ff to your computer and use it in GitHub Desktop.
select
status as "Статус"
, count(*) as "Кол-во"
, sum(case when score = 1 then 1 else 0 end) as "Оценка 1"
, sum(case when score = 2 then 1 else 0 end) as "Оценка 2"
, sum(case when score = 3 then 1 else 0 end) as "Оценка 3"
, sum(case when score = 4 then 1 else 0 end) as "Оценка 4"
, sum(case when score = 5 then 1 else 0 end) as "Оценка 5"
, sum(case when score is null then 1 else 0 end) as "Без оценки"
from
home.dt_banki_responses
where
date(create_dt) >= '2021-01-01'
group by status
order by 2 desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment