mysql order by multiple fields

MySql Order By Multiple Field Collation

For example: if you want to sort by ConfigID and MarketID


There are the following statements:

SELECT * FROM TABLE ORDER BY ConfigID, MarketID DESC;

Then the result:


Analysis: In fact, this statement is equivalent to: first in ascending order by ConfigID, and then in descending order by MarketID.

SELECT * FROM dngameconfig ORDER BY ConfigID ASC, MarketID DESC;

If you want all in descending order, you need to write this:

SELECT * FROM dngameconfig ORDER BY ConfigID DESC, MarketID DESC;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324474019&siteId=291194637