【发布时间】:2013-12-09 06:31:43
【问题描述】:
这是我获取特定日期订单总额的查询。在这里,使用 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')
【问题讨论】:
-
(tos.status!='5' or tos.status!='6')总是正确的。因为不是 5 也不是 6。条件应该怎么办? -
如果我给 AND tos.
status!='6',它显示正确的结果 -
告诉我们您的具体情况以及您在查询中所说的具体内容?
-
@Prakash - 请添加该评论作为答案。
标签: mysql sql select where notin