I've got a table with a datetime field that I need to sort. Doing the following:
SELECT date_format(date, '%m/%d/%y @ %h:%i %p') as date ORDER BY date DESC
results in the times being sorted, but by absolute value. For example, 11:00 AM is above 10:00 PM, even if 10:00 PM is the later date.
Something like this happens:
11:00 AM
10:00 PM
9:00 AM
8:00 PM
when it should really be:
10:00 PM
8:00 PM
11:00 AM
9:00 AM
is there a MySQL command that will rectify this or would I have to code something?
SELECT date_format(date, '%m/%d/%y @ %h:%i %p') as date ORDER BY date DESC
results in the times being sorted, but by absolute value. For example, 11:00 AM is above 10:00 PM, even if 10:00 PM is the later date.
Something like this happens:
11:00 AM
10:00 PM
9:00 AM
8:00 PM
when it should really be:
10:00 PM
8:00 PM
11:00 AM
9:00 AM
is there a MySQL command that will rectify this or would I have to code something?