SQL multiple column ordering

后端 未结 5 2197
梦谈多话
梦谈多话 2020-11-22 02:40

I am trying to sort by multiple columns in SQL, and in different directions. column1 would be sorted descending, and column2 ascending.

How

5条回答
  •  别跟我提以往
    2020-11-22 03:35

    Multiple column ordering depends on both column's corresponding values: Here is my table example where are two columns named with Alphabets and Numbers and the values in these two columns are asc and desc orders.

    Now I perform Order By in these two columns by executing below command:

    Now again I insert new values in these two columns, where Alphabet value in ASC order:

    and the columns in Example table look like this. Now again perform the same operation:

    You can see the values in the first column are in desc order but second column is not in ASC order.

提交回复
热议问题