模糊查询有以下三种方法:
1.Convert转成String,再用Like查询。适用于任何数据类型:
select * from table where convert(varchar,date,120) like '2018-08-22%'
2.Between。适用于String外的类型:
select * from table where time between '2018-8-22 0:00:00' and '2018-8-22 24:59:59'
3 datediff()函数,为date类型定制的比较实用快捷的方法:
select * from table where datediff(day,time,'2018-8-22')=0 |