--分解做法,容易看懂 with tiaojian as ( select cs.customer_id, cs.customer_name, count(distinct os.order_id ) as feb_2024_order_count, ifnull(sum(qty*price),0) as feb_2024_total_amount , ifnull( round( ifnull(sum(qty*price),0)/count(distinct os.order_id),2),0) as feb_2024_avg_order_amount from customers cs l...