2、根据需求所需的数据表,挑选展示字段 select date_format(event_time, '%Y-%m') as month, sum(case when status = 1 then total_amount else 0 end) + sum(case when status = 0 then total_amount else 0 end) as GMV from tb_order_overall 1、对数据表进行条件筛选(若订单下单之后(=1)又被退款(=2),那么就不能计算GMV) where status != 2 and extract(year from event_time) = '2021' group by 1 3、对分组统计后的数据,进行GMV的条件筛选 having GMV > 100000 order by 2