I have dates stored as strings in a table (column name is 'log_event') - yeah, I know it should be a real date type - but I'm working with an existing table that I didn't create, etc.
Anyway, dates are in the column in the form of
'08/14/2014 1:01 am' (or pm)
I'm really just trying to get a SELECT based on the date portion of the string (I don't care about the time for the purpose of my SELECT, I just need all rows that have a date of between say date1 and date2), and I've tried:
SELECT * FROM db_event_log WHERE STR_TO_DATE(log_event,'%m/%d/%Y') > STR_TO_DATE('08/01/2014', '%m/%d/%Y')
but my SELECT returns NULL
(Yes, I know this doesn't SELECT between two dates - I'm just trying to build a query string step-by-step to see that I've got it right, before trying to go to the next level)
I've also tried to format for the time as well by doing:
SELECT * FROM db_event_log WHERE STR_TO_DATE(log_event,'%m/%d/%Y %l:%i %p') > STR_TO_DATE('08/01/2014 12:00 am', '%m/%d/%Y %l:%i %p')
which also returns a NULL selection.
Where am I going wrong?