I have write this code but not get proper record.
1.
SELECT first_name,date
from user where date between '01-05-2012' and '05-05-2012'
2.
SELECT first_name,date from user
where date >= '01-05-2012' date <= '05-05-2012'
What is the problem in above code? What will be the write query?
Here is Sample data
first_name date
Sonu 23-01-2012
Saqib 20-02-2012
Sachin 01-04-2012
Ankit 17-08-2012
Michal 12-13-2011
Convert your date first using
STR_TO_DATEThis will select dates starting from
June 01 2012untilDecember 05 2012SQLFiddle Demo
if you really want to stick with your format,
SQLFiddle Demo