search

Home  >  Q&A  >  body text

java - 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 

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

巴扎黑巴扎黑2889 days ago364

reply all(2)I'll reply

  • 阿神

    阿神2017-04-17 17:54:16

    It is estimated that the default is 2016-05-06 00:00:00
    You use
    createTime between '2016-05-04 00:00:00' and '2016-05-06 23:59:59' Try

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:54:16

    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

    reply
    0
  • Cancelreply