题解 | 淘宝店铺的实际销售额与客单价
淘宝店铺的实际销售额与客单价
https://www.nowcoder.com/practice/ce116419a1f141568094b5eab70e5ce8
SELECT ROUND(t.sales_total, 3) AS sales_total, ROUND(t.sales_total/t.user_num, 3) AS per_trans FROM ( SELECT SUM(sales_num * goods_price) AS sales_total, COUNT(DISTINCT user_id) AS user_num FROM sales_tb JOIN goods_tb ON sales_tb.goods_id = goods_tb.goods_id) t