题解 | #计算商城中2021年每月的GMV#
计算商城中2021年每月的GMV
https://www.nowcoder.com/practice/5005cbf5308249eda1fbf666311753bf
SELECT DATE_FORMAT(event_time,"%Y-%m") as month, sum(case status when '0' THEN total_amount when '1' THEN total_amount ELSE 0 END) as GMV FROM tb_order_overall WHERE year(event_time)='2021' GROUP BY month HAVING GMV > 100000 ORDER BY GMV