码迷,mamicode.com
首页 > 数据库 > 详细

SQL比较时间查询语句

时间:2017-07-03 13:50:20      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:table   sql   datetime   div   oom   highlight   通过   pre   style   

 

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比较时间查询语句

标签:table   sql   datetime   div   oom   highlight   通过   pre   style   

原文地址:http://www.cnblogs.com/Raywang80s/p/7110455.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!