我有这个查询
Select ID, title,tags from items where ID != 305096 AND title LIKE '%airplane%' or title LIKE '%car%' ORDER BY ID DESC LIMIT 20
除了ID == 305096之外,我想获得所有结果。我还尝试使用'<>'但都没有用。 你有什么主意吗?谢谢!
答案 0 :(得分:3)
Select ID, title,tags from items where ID != 305096 AND (title LIKE '%airplane%' or title LIKE '%car%') ORDER BY ID DESC LIMIT 20
答案 1 :(得分:1)
必须与括号分组:
Select ID, title,tags from items where ID != 305096 AND (title LIKE '%airplane%' or title LIKE '%car%') ORDER BY ID DESC LIMIT 20
答案 2 :(得分:0)
尝试围绕你的逻辑做一些事情:
Select ID, title,tags from items
where (ID != 305096) AND (title LIKE '%airplane%' or title LIKE '%car%')
ORDER BY ID DESC LIMIT 20