猿问

mysql根据时间查询记录返回结果中始终缺少当天的数据?

select o.* from user o where 1=1  and userId = 100041 and  createTime between '2016-05-04' and  '2016-05-06'  order by o.createTime desc 

始终缺少当天比如六号那天的记录,该怎么办?


交互式爱情
浏览 696回答 2
2回答

慕桂英3389331

估计默认的是 2016-05-06 00:00:00 了你用createTime between '2016-05-04 00:00:00' and '2016-05-06 23:59:59' 试试

千巷猫影

select o.* from user o where 1=1 and userId = 100041 and createTime between '2016-05-04' and '2016-05-07' order by o.createTime desc
随时随地看视频慕课网APP

相关分类

Java
我要回答