Created
October 14, 2021 19:23
-
-
Save meanother/821957070d9342aee81f2c060dbeb0e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
substr(create_dt::varchar,1,7) as month | |
, round(avg(coalesce(score, 0)), 1) as "Среднее" | |
, trunc(median(coalesce(score, 0))) 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' | |
and status in ('Проблема решена', 'Зачтено') | |
group by substr(create_dt::varchar,1,7) | |
order by substr(create_dt::varchar,1,7) asc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment