最佳答案
如何按两列对MySQL表进行排序?
我想要的是文章排序最高评级,然后是最近的日期。例如,这将是一个示例输出(左#是评分,然后是文章标题,然后是文章日期)
+================+=============================+==============+ | article_rating | article | article_time | +================+=============================+==============+ | 50 | This article rocks | Feb 4, 2009 | +----------------+-----------------------------+--------------+ | 35 | This article is pretty good | Feb 1, 2009 | +----------------+-----------------------------+--------------+ | 5 | This Article isn't so hot | Jan 25, 2009 | +================+=============================+==============+
我使用的相关SQL是:
ORDER BY article_rating, article_time DESC
我可以按一个或另一个排序,但不能同时排序。