我正在尝试汇总orders
表的total_grand
列。
所以我有这个查询
SELECT sum(total_grand) as total
FROM `orders`
WHERE overall_status in ("In-Transit","Not Yet Shipped","Not Yet Validated");
它运行良好。但我需要添加新的条件语句。
这是我的带有数据的示例orders
表列。
total_grand | overall_status | televifier_user_id | |
---|---|---|---|
100 | 在途 | 1||
200 | 尚未发货 | <1>||
300 | 尚未验证 | NULL | |
400 | 尚未验证 | <1>||
500 | In-td> | 1 | |
------------------ | ------------------ | ------------------ |
SELECT sum(total_grand) as total
FROM `orders`
WHERE overall_status in ("In-Transit", "Not Yet Shipped", "Not Yet Validated")
AND televalidator_user_id is not null;