select case SUBST_ID when 16000172 then '1陆丰' when 16000065 then '2海丰' when 16000002 then '3城区' when 16000280 then '4陆河' when 16001009 then '5政企' else '其他' end subst_name, DISC_CLASS, case DISC_CLASS when 1 then '纯新套餐' when 2 then '存量加装' when 3 then '存量变更' when 4 then '拆机销户' when 5 then '优惠到期' end disc_class_zh, sum(value02), count(distinct serv_id) from zone_sw.TB_TYKS_SCORE_INC_MTD_mon where SUM_DATE = '20240827' and PROD_ID2 IN ('1010', '1011', '1012', '1013', '1015') group by case SUBST_ID when 16000172 then '1陆丰' when 16000065 then '2海丰' when 16000002 then '3城区' when 16000280 then '4陆河' when 16001009 then '5政企' else '其他' end, DISC_CLASS order by subst_name, DISC_CLASS desc;
理解问题select case SUBST_ID when 16000172 then '1陆丰' when 16000065 then '2海丰' when 16000002 then '3城区' when 16000280 then '4陆河' when 16001009 then '5政企' else '其他' end subst_name, DISC_CLASS, case DISC_CLASS when 1 then '纯新套餐' when 2 then '存量加装' when 3 then '存量变更' when 4 then '拆机销户' when 5 then '优惠到期' end disc_class_zh, sum(value02), count(distinct serv_id) from zone_sw.TB_TYKS_SCORE_INC_MTD_mon where SUM_DATE = '20240827' and PROD_ID2 IN ('1010', '1011', '1012', '1013', '1015') group by case SUBST_ID when 16000172 then '1陆丰' when 16000065 then '2海丰' when 16000002 then '3城区' when 16000280 then '4陆河' when 16001009 then '5政企' else '其他' end, DISC_CLASS order by subst_name, DISC_CLASS desc;
已完成理解「select case SUBST_ID when 16000172 then '1陆丰' when 16000065 then '2海丰' when 16000002 then '3城区' when 16000280 then '4陆河' when 16001009 then '5政企' else '其他' end subst_name, DISC_CLASS, case DISC_CLASS when 1 then '纯新套餐' when 2 then '存量加装' when 3 then '存量变更' when 4 then '拆机销户' when 5 then '优惠到期' end disc_class_zh, sum(value02), count(distinct serv_id) from zone_sw.TB_TYKS_SCORE_INC_MTD_mon where SUM_DATE = '20240827' and PROD_ID2 IN ('1010', '1011', '1012', '1013', '1015') group by case SUBST_ID when 16000172 then '1陆丰' when 16000065 then '2海丰' when 16000002 then '3城区' when 16000280 then '4陆河' when 16001009 then '5政企' else '其他' end, DISC_CLASS order by subst_name, DISC_CLASS desc;」
展开阅读网页