[步骤]
SELECTSUM( tt.product_num ) AS product_num,
SUM( tt.sku_count ) AS sku_count
FROM
(
SELECT
SUM( b.product_num + b.product_num_update ) AS product_num,
COUNT( DISTINCT b.sku ) AS sku_count
FROM
t_stk_order_info a
LEFT JOIN t_stk_order_list b ON a.order_code = b.order_code
AND a.customer_id = b.customer_id
LEFT JOIN t_stk_order_info_beikuexpand c ON a.order_code = c.order_code
AND a.customer_id = c.customer_id
WHERE
1 = 1
and a.add_time >= '2026-08-29 00:00:00'
and '2026-10-28 23:59:59' >= a.add_time
and a.order_status in
(
0
,
5
)
AND b.product_num + b.product_num_update > 0
GROUP BY
a.order_code,
a.customer_id
) tt
[结果]
[期望]
补充 and a.customer_id=1的条件
