Skip to content
Advertisement

SQL ~ How to sort alphabetically WHEN value is same

I have table like this ordered in DESC order by value “key”:

name | key
Bman  9.5
Cman  9.5
Aman  9.5
Ara   9.3

I want to sort it alphabetically when the key value is same So I want it to be like this:

name | key
Aman  9.5
Bman  9.5
Cman  9.5
Ara   9.3

How can I do that?

Advertisement

Answer

Just use two order by keys:

order by key desc, name
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement