题解 | 淘宝店铺的实际销售额与客单价
淘宝店铺的实际销售额与客单价
https://www.nowcoder.com/practice/ce116419a1f141568094b5eab70e5ce8
看着好像没有加入时间限定条件得,加了一个12月下旬where条件
select round(sum(sale_sum),3) as sales_total, round(sum(sale_sum) / count(distinct user_id),3) as per_trans from ( select s.goods_id,user_id,goods_name, (sales_num*goods_price) as sale_sum from sales_tb as s left join goods_tb as g on s.goods_id = g.goods_id where sales_date between '2021-12-21' and '2021-12-31' ) as t