MySQL get latest X rows, while ordering by column?
I need to get the latest X rows. So I do something like
SELECT * FROM `item` ORDER BY `date` DES开发者_JS百科C LIMIT X
But I want to items to be returned ordered by column Y, where Y!=date
How can this be done?
Subselect
SELECT * FROM
(SELECT * FROM `item` ORDER BY `date` DESC LIMIT X)
ORDER BY Y
精彩评论