My query is
select *
from emp
where DATE_FORMAT(approved_date,'%d-%m-%Y')BETWEEN '01-01-2014' and '26-01-2014';
But it displays the records in the year of 2013.
Table is approved date:
01-10-2013
01-01-2014
25-2-2014
Try this:
select * from emp
where approved_date
BETWEEN STR_TO_DATE('18-01-2014', '%d-%m-%Y')
AND STR_TO_DATE('26-01-2014', '%d-%m-%Y')
Working Demo: http://sqlfiddle.com/#!2/b4d7e/13
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments