mysql日期模糊查找的方法
Mysql模糊查询有以下三种方法:
1.Convert转成日期时间型,在用Like查询。select * from table1 where convert(date,DATETIME) like ‘2006-04-01%‘
第一种方法应该适用与任何数据类型;
2.Betweeselect * from table1 where time between ‘2018-08-01 0:00:00‘ and ‘2018-08-01 24:59:59‘";
第二种方法适用String外的类型;
3 datediff()函数select * from table1 where datediff(create_time,‘2018-08-01‘)=0 第三种方法则是为date类型定制的比较实用快捷的方法。
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/21907.html
- 上一篇:MySQL操作(三)数据表
- 下一篇:数据库优化 - SQL优化