How to sort by date when day, month and year are each in a column?

0

Hello,

I have the following situation, I have to sort a table by date, but for some particular reason the programmer decided to save the day, month and year in separate columns, since the database is in MySql, there is an effective procedure for make such an order?

Would it be correct to use ORDER BY day, month and year?

Thank you.

    
asked by anonymous 15.07.2014 / 03:07

1 answer

2

If the type of columns is integer, just make a ORDER BY ANO, MES, DIA . If it is in textual format, especially if you have mixed values with two or a digit, check the link that the user "lost" commented on your question.

    
15.07.2014 / 03:34