ORDER BY datetime DESC
将这些作为我的结果给我
2016-02-24 12:45:00
2016-02-20 18:00:00
2016-02-22 16:00:00
这对我来说没有意义,它怎么能这样排序?我的数据库结构将列设置为" DATETIME"所以我不知道这是否影响了它,但我如何按日期和时间订购时间?
编辑#1:
SELECT teams.t_id, teams.t_name, t.t_id AS t_id2, t.t_name AS t_name2, matches.m_id, matches.m_datetime, divisions.d_id, divisions.d_name, leagues.l_id, leagues.l_name
FROM matches
LEFT JOIN teams ON teams.t_id = matches.m_tid
LEFT JOIN teams t ON t.t_id = matches.m_tid2
LEFT JOIN divisions ON divisions.d_id = matches.m_did
LEFT JOIN leagues ON leagues.l_id = divisions.d_lid
WHERE leagues.l_id = ?
ORDER BY matches.m_datetime DESC, matches.m_id DESC
查询有效,但由于某种原因它没有排序。