-2

I have a table having customer name, and their 2 ids- id 1 and id 2. Id2 is distinct for all customers but id1 is same for some of them. I want to sort the table in descending order on the basis of id 1.

SELECT * FROM table_name ORDER BY id1 DESC works fine but same id1 should be sorted in descending order on the basis of their id2 value.

someone please help me how to achieve this. thanks.

Shivam Pande
  • 184
  • 2
  • 14

1 Answers1

1

The ORDER BY keyword takes several arguments: https://www.w3schools.com/sql/sql_orderby.asp

SELECT * FROM table_name ORDER BY id1 DESC, id2 DESC
rochy_01
  • 161
  • 1
  • 8