在那里,我有一个发布= 3值的文件
但是这个查询打印出来了!(它不应该)
SELECT * FROM article WHERE publish BETWEEN 0 AND 2 AND feature = '1'
AND sid = '3' OR sid = '4' OR sid = '5' OR sid = '6' OR sid = '7'
OR sid = '8' OR sid = '9' OR sid = '10' AND created BETWEEN 0
AND 1446078164 ORDER BY id DESC LIMIT 0, 6
我错了什么?
更多信息:
在哪里,有4个主要聚集: 在哪里发布BETWEEN 0和2
AND feature = '1'
AND sid = '3' OR sid = '4' OR sid = '5' OR sid = '6' OR sid = '7'
OR sid = '8' OR sid = '9' OR sid = '10'
AND created BETWEEN 0 AND 1446078164
答案 0 :(得分:2)
您需要括号,可能需要in
。我猜你想要的逻辑是:
SELECT *
FROM article
WHERE publish BETWEEN 0 AND 2 AND
feature = '1' AND
sid IN ('3', '4', '5', '6', '7' , '8', '9', '10') AND
created BETWEEN 0 AND 1446078164
ORDER BY id DESC
LIMIT 0, 6;