当前位置:Gxlcms > 数据库问题 > 关于SQL时间类型的模糊查询

关于SQL时间类型的模糊查询

时间:2021-07-01 10:21:17 帮助过:29人阅读

1.Convert转成String,在用Like查询。

select * from table1   where convert(varchar,date,120) like   ‘2006-04-01%‘  

 

2.Between

select * from table1 where time between ‘2006-4-1 0:00:00‘ and ‘2006-4-1 24:59:59‘";

SQL语句根据具体时间查询数据

时间格式为:年/月/日 时:分:秒

例如:2017/2/28 16:23:23

sql语句为:selecte * from A where createtime=to_date(‘2017/2/28 16:23:23‘ ,‘yyyy/mm/dd hh24:mi:ss‘);


 

3 datediff()函数

select * from table1   where datediff(day,time,‘2006-4-1‘)=0

关于SQL时间类型的模糊查询

标签:ted   table   between   时间   语句   时间类   arc   string   tween   

人气教程排行