I am trying select the max timestamp value for a field that contains timestamp values, but is actually a text field. Before you say it, I can’t change the field type because the app that populates it is not changeable. It’s annoying, I know.
The format of the Timestamp is
Wed Mar 02 13:28:59 CST 2011 -> this is actually a text value in MYSQL
Here’s my attempt:
SELECT DISTINCT MAX(STR_TO_DATE(`Timestamp`, '%d, %m, %Y')) FROM `table`
‘Timestamp’ is referring to the column called Timestamp.
This just returns NULL values for the timestamp.
Thanks for any help.
This should work for you, also have a look at http://www.w3schools.com/sql/func_date_format.asp
Test case example: