数据库
首页 > 数据库> > SQL根据时间查询数据

SQL根据时间查询数据

作者:互联网

查询当天的数据

DateDiff(create_time,sysdate())=0

根据时间随机查询当天的数据

select * from **** where time BETWEEN #{createTime}and DATE_SUB(#{createTime},INTERVAL -1 DAY) order by create_time desc limit 1
//查询当天的数据,并对此排序,然后获取最新一条数据

 

标签:create,SQL,查询,当天,time,数据,createTime
来源: https://www.cnblogs.com/xiaoyanger-study/p/16428033.html