Reputation: 615
I want to sort date in msSQL database, which is stored like: Wednesday, February 13, 2016
For example, I have:
-Thursday, January 7, 2016
-Wednesday, February 10, 2016
Wednesday, December 30, 2015
Wednesday, December 9, 2015
and this should be sorted like:
I have tried following query: select * from appointment order by date asc;
But it sorts alphabetically, by just seeing first letter of week. How should I sort it by actual timing. Thanks
Upvotes: 1
Views: 148
Reputation: 1368
Try this,
SELECT
*
FROM
appointment
ORDER BY
STR_TO_DATE(date, '%W, %M %e, %Y');
Upvotes: 1