我正在编写下面指定的查询,它没有错误,但没有获取与服务器当前日期匹配的正确记录,在其他部分它显示了旧记录
我的Mysql查询:
select news_title,
full_url,
source_site,
date_added,
`category`
from tbl_urlLog
where category like '%enter%'
or category like '%hollywood%'
or category like '%bollywood%'
or category like '%movies%'
or category like '%film%'
and date (`date_added`) = date (CURDATE())
group by `source_site`
order by `date_added` desc LIMIT 3
最佳答案
我猜您想使用括号将所有 OR
组合在一起。另外,curdate()
已经是日期,无需对其调用date()
。
select news_title,
full_url,
source_site,
date_added,
`category`
from tbl_urlLog
where (
category like '%enter%'
or category like '%hollywood%'
or category like '%bollywood%'
or category like '%movies%'
or category like '%film%'
)
and date (`date_added`) = CURDATE()
group by `source_site`
order by `date_added` desc LIMIT 3
关于mysql - 关于Mysql中当前日期的比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43176852/