0 votes
1 view
in SQL by (20.3k points)

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

How can I do this?

1 Answer

0 votes
by (40.3k points)

Try this code:

ORDER BY column 1 DESC, column 2

The above code sorts everything by column 1 (in descending order) first, and then by column 2 (in ascending order, which will be done by default), it happens whenever the column 1 fields for two or more rows are equal.

Related questions

0 votes
1 answer
asked Jul 22, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...