Sorting multiple fields in MySQL

后端 未结 2 402
轮回少年
轮回少年 2021-01-11 16:19

I have a table with 2 fields DATE and IMPORTANCE. Now I want to sort both these fields in DESCENDING ORDER so that the rows are ordered by IMPORTANCE for EACH DATE. For ex

2条回答
  •  生来不讨喜
    2021-01-11 17:01

    You can add as many fields to ORDER BY as you want.

    That'd be something like:

    SELECT * FROM table ORDER BY `date` DESC, `importance` DESC
    

提交回复
热议问题