用我的数据库运行这个查询语句后:
select * from articles
where content like 'keyword1' or content like
keyword2' or content like 'keyword3' and date
between '2012-06-18 00:00:00' and '2012-06-25 23:59:59'
order by date asc
我能够取回根据日期排序的文章,其内容包含那些指定的关键字但不在日期范围内。任何人都可以让我知道这个声明有什么问题以及如何更正它吗?
谢谢!
最佳答案
select * from articles where (content like 'keyword1' or content like 'keyword2' or content like 'keyword3') and (date between '2012-06-18 00:00:00' and '2012-06-25 23:59:59') order by date asc
试一试。
关于mysql - 多条件查询语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11237855/