mysql ORDER BY date_time field not sorting as expected
Posted
by undefined
on Stack Overflow
See other posts from Stack Overflow
or by undefined
Published on 2010-05-21T13:57:28Z
Indexed on
2010/05/21
14:00 UTC
Read the original article
Hit count: 129
I have a field in my database that stores the datetime that an item was added to the database. If I want to sort the items in reverse chronological order I would expect that doing ORDER by date_added DESC would do the trick. But this seems not to work. I also tried ORDER by UNIX_TIMESTAMP(date_added) but this still did not sort the results as I would expect. I also have an auto-increment field that I can use to sort items so I will use this, but I am curious as to why ORDER by datetime was not behaving as expected.
any ideas?
© Stack Overflow or respective owner