有关于时间的模糊查询有以下三种方法: 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'"; 3 datediff()函数 select * from table1 where datediff(day,time,'2006-4-1')=0 第一种方法应该适用与任何数据类型; 第二种方法适用String外的类型; 第三种方法则是为date类型定制的比较实用快捷的方法。
有关于时间的模糊查询
最新推荐文章于 2021-03-17 16:40:50 发布