统计状态为 'unknown' 的订单包含多少订单行、总金额是多少。
- 只看
status = 'unknown'的订单,取出它们在order_items里的全部订单行。 cnt:这些订单行的行数。total:这些订单行的qty × unit_price之和(忽略折扣)。- 没有任何符合条件的订单行时,结果仍然是一行,
cnt = 0、total = 0(不是 null,也不是 0 行)。共享数据里根本没有unknown状态的订单。
输入
orders(order_id, customer_id, order_ts, status, channel)order_items(order_id, product_id, qty, unit_price, discount)
输出
恰好一行,列为 cnt, total。