I have a field containing dates in this format DD/MM/YYYY and I need to order the results DESC by this field, but it is saved as a VARCHAR and I cannot change this. Is there a workaround?
There really is no way for me to change the field type so please don't say this is a bad way to do this as I already know. I just need to know if it is possible.
Thanks for any help and advice in advance.
You can do it by the following way,
use this
STR_TO_DATE
Use
STR_TO_DATE()
MySQL function:sidenote:
STR_TO_DATE
converts String to Date whileDATE_FORMAT
converts Date to StringUsing
STR_TO_DATE
:http://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html#function_str-to-date