I wonder if anyone has come across this issue before.
I have a string converted to a date and sorted ascending. The date is sorting numerically but it is not sorting on the month. I wonder if anyone has had this issue and can shed some insight as to how to get the date to sort correctly.
SELECT
u.url_id,
url,
title,
description,
pub_date,
DATE_FORMAT(STR_TO_DATE(pub_date, '%d-%b-%Y'), '%d.%b.%Y') AS pub_date,
pub_date AS sortdate
FROM
urls AS u,
url_associations AS ua
WHERE
u.url_id = ua.url_id
AND ua.url_category_id=$type
AND ua.approved = 'Y'
ORDER BY
sortdate DESC
The above is the code and it works but the date isn't sorting eg it sorts like this:
29-may-2009
28-may-2009
27-may-2009
02-june-2009
01-june-2009