I have my date in database in varchar column and i can't change it. However i want to sort things from newest to latest. My date in database looks like:
2014-09-22 10:28:28 So what i try is something like:
$sql = "SELECT * FROM axnmrs_cases WHERE vin = :vin ORDER BY STR_TO_DATE(date_created,'%b-%e-%Y') ASC LIMIT 30"; But unfortunately this not change anything for me , even if i change ASC to DESC , nothing changeing in result
and also something like:
$sql = "SELECT * FROM axnmrs_cases WHERE vin = :vin ORDER BY CONVERT(date_created, date, 103)"; This throw syntax SQL error and I have no idea why.
Is here anybody who can show me the right way?