RSS

Category Archives: mysql

MySQL search by date range

MySQL search by date range

SELECT *
FROM table1
WHERE STR_TO_DATE(`date`,’%Y-%m-%d’) BETWEEN ‘2013-05-01’ AND ‘2013-05-03’

SELECT *
FROM enquriy
WHERE STR_TO_DATE( `dat` , ‘%d-%m-%Y’ )
BETWEEN ‘2014-06-01’
AND ‘2014-06-03’
AND toemail = ‘gurkirpal.cgc@gmail.com’
LIMIT 30 , 30

STR_TO_DATE
http://www.w3resource.com/mysql/date-and-time-functions/mysql-str_to_date-function.php

 
Leave a comment

Posted by on July 21, 2014 in mysql