Mysql date methods of fuzzy search

There are three ways fuzzy Mysql query:

1.Convert turn into a time-date, with Like queries. select * from table1 where convert (date , DATETIME) like '2006-04-01%'
first method should be applicable to any data type;

2.Betweeselect * from table1 where time between ' 2018-08-01 0:00:00' and '2018-08-01 24:59:59' ";
The second method is suitable for the type of external String;

3 datediff()函数select * from table1 where datediff(create_time,'2018-08-01')=0
The third method is for the date type custom more practical and efficient method.

Guess you like

Origin www.cnblogs.com/superming/p/11780991.html