商品信息汇总表
user_id,
sum(case
when pay_type not in (‘退货’,’拒收’) then
goods_amount
end) p_sales_cnt,-排除退拒销售数量
sum(case
when pay_type not in (‘退货’,’拒收’) then
goods_price * goods_amount
end) p_sales_amt,-排除退拒销售金额
sum(case
when pay_type not in (‘退货’,’拒收’) then
(goods_price – ‘优惠价’) * goods_amount
end) p_sales_cnt_amt,-排除退拒销售金额(扣促销减免)
sum(goods_amount) h_sales_cnt, -含退拒销售数量
sum(goods_price * goods_amount) h_sales_amt, -含退拒销售金额
sum((goods_price – ‘优惠价’) * goods_amount) h_sales_cut_amt, -含退拒销售金额(扣促销减免)
sum(case
when pay_type in (‘退货’) then
goods_amount
end) return_cnt,-退货商品数量
sum(case
when pay_type in (‘退货’) then
goods_price * goods_amount
end) return_amt,-退货商品金额
sum(case
when pay_