0

这是我获取特定日期订单总额的查询。在这里,使用 AND (tos.status!='5' 或 tos.status!='6') 时我无法得到正确的结果。这有什么问题?

SELECT sum(tot.total) as total 
FROM orders_totals tot, orders tos 
WHERE DATE(tos.`timestamp`) BETWEEN '2013-12-09' AND '2013-12-09' and 
      tot.`order` = tos.id and tot.description='Grand-Total' AND 
     (tos.status!='5' or tos.status!='6')
4

1 回答 1

0

尝试这个:

SELECT sum(tot.total) as total 
FROM orders_totals tot
INNER JOIN orders tos ON tot.`order` = tos.id
WHERE DATE(tos.`timestamp`) BETWEEN '2013-12-09' AND '2013-12-09' and 
      tot.description='Grand-Total' AND tos.status NOT IN (5, 6)
于 2013-12-09T07:14:36.837 回答