I am having a problem in making a query. I have a table in which dates are saved in
varchar format and I want to compare these dates in my search query. I want to take two input dates from the user i.e. starting date and ending date and I want to compare these dates with my varchar fields in which dates are saved. As far as I know we cannot compare dates if they are in varchar format. I made a query for this
SELECT id,start_date,end_date FROM dates WHERE (start_date,'%m/%d/%Y')>='2012-01-01' AND (end_date,'%m/%d/%Y')<='2012-12-01'
I have values in my table which fall in these dates but it is not displaying me any result. The dates saved in my table are in the format of m/d/Y and I have checked the query if I execute this query
SELECT id,STR_TO_DATE (start_date,'%m/%d/%Y'),STR_TO_DATE (end_date,'%m/%d/%Y') FROM dates
It prints the result of the selected date in the date format in which mysql stores the date. Please Help. Thanks in advance