3 回答

TA貢獻(xiàn)1780條經(jīng)驗 獲得超5個贊
默認(rèn)排序是升序,您需要將關(guān)鍵字DESC添加到您的訂單:
ORDER BY article_rating DESC, article_time DESC

TA貢獻(xiàn)1804條經(jīng)驗 獲得超8個贊
ORDER BY article_rating, article_time DESC
僅當(dāng)有兩篇具有相同評級的文章時才會按article_time排序。從我在你的例子中可以看到的一切,這正是發(fā)生的事情。
↓ primary sort secondary sort ↓
1. 50 | This article rocks | Feb 4, 2009 3.
2. 35 | This article is pretty good | Feb 1, 2009 2.
3. 5 | This Article isn't so hot | Jan 25, 2009 1.
但考慮一下:
↓ primary sort secondary sort ↓
1. 50 | This article rocks | Feb 2, 2009 3.
1. 50 | This article rocks, too | Feb 4, 2009 4.
2. 35 | This article is pretty good | Feb 1, 2009 2.
3. 5 | This Article isn't so hot | Jan 25, 2009 1.
添加回答
舉報