select * from table1
where datediff(mm,'2009-8-12 13:17:50', date)>0
select * from table1 where datediff(ms,'2009-8-12 13:17:50', date)>0
select * from table1 where cast(date as datetime)>'2009-8-12 13:17:50'
select * from table1 where CONVERT(DATETIME,date)>'2009-8-12 13:17:50'
本人测试这条也能通过:
select * from RoomInfo where CreateTime > '2017/7/3 10:46:33';
本文介绍了几种使用SQL进行日期比较的方法,包括使用DATEDIFF函数按月和毫秒对比日期,以及直接将日期转换为DATETIME类型进行大小比较。这些技巧对于处理数据库中涉及时间的数据非常实用。
5244

被折叠的 条评论
为什么被折叠?



