使用例
SELECT
SUM("人数") AS "全会員",
SUM(CASE WHEN "会員ランク" in (1,2,3,4,6,7,8,9) THEN "人数" ELSE 0 END) AS "リピータ人数(1,2,3,4,6,7,8,9)",
SUM(CASE WHEN "会員ランク" in (10) THEN "人数" ELSE 0 END) AS "離脱人数(10)",
SUM(CASE WHEN "会員ランク" in (1,2,3,4,6,7,8,9) THEN "人数" ELSE 0 END) / SUM("人数") AS "リピータ化割合",
SUM(CASE WHEN "会員ランク" in (10) THEN "人数" ELSE 0 END) / SUM("人数") AS "離脱割合",
~
参考
https://qiita.com/hisaitami/items/2ede408806088e634eed