java - mysql根据时间查询记录返回结果中始终缺少当天的数据?
巴扎黑
巴扎黑 2017-04-17 17:52:16
0
2
371
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 

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

巴扎黑
巴扎黑

全部回复(2)
阿神

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

大家讲道理

从用户 o 中选择 o.*,其中 1=1 且 userId = 100041 且 createTime 介于 '2016-05-04' 和 '2016-05-07' 之间,按 o.createTime desc 排序

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板