1. 首先,子查询:where中 筛选 202110,按 product_id 分组,用 count(*) 统计出展示数,用 sum() 统计出点击数,加购数,付款数,退款数。 with tb as( select product_id, count(*) show_cnt, sum(if_click) click_cnt, sum(if_cart) cart_cnt, sum(if_payment) pay_cnt, sum(if_refund) refund_cnt from ...