mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
6 lines
224 B
MySQL
6 lines
224 B
MySQL
|
SELECT round((countIf(rating = 5)) - (countIf(rating < 5)), 4) as nps,
|
||
|
dense_rank() OVER (ORDER BY nps DESC) as rank
|
||
|
FROM (select number as rating, number%3 rest_id from numbers(10))
|
||
|
group by rest_id
|
||
|
order by rank;
|