-1

I am using three columns while sorting the table using an order by clause. First column is sorted by ascending order and other two columns are sorted by descending order. In my case all three columns have to sort by ascending order.

Can you please give me solution for this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Saravanan
  • 1
  • 1
  • The official [docs](https://learn.microsoft.com/en-us/sql/t-sql/queries/select-order-by-clause-transact-sql?view=sql-server-ver15) should always be your first point of reference. – Dale K Feb 28 '20 at 05:01

1 Answers1

0

You can include as many fields as you want in the ORDER BY clause:

SELECT a, b, c FROM the_table ORDER BY a ASC, b ASC, c ASC;
Daniel McLaury
  • 4,047
  • 1
  • 15
  • 37