Sunday, 18 August 2013

MySQL sort on year/month/day

MySQL sort on year/month/day

I have a large list of dates in the typ dd-mm-yyyy. So I want to order on:
year, than on month and than on day.
Date and month are in the same field and year is an other field.
I now have: "ORDER BY table.year ASC, table.date ASC" The result is that
the list is order on year and then days.
How to split/strip the dd-mm format and first sort on month before sorting
on days?

No comments:

Post a Comment