Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL order by two columns

Author  Topic 

i11usive
Starting Member

4 Posts

Posted - 2014-10-18 : 04:42:24
Hi - I'm sure this is pretty straight forward to some of you guys, but I can't seem to work it out. I have the following data:

Name Played Won
Player 1 15 14
Player 2 15 5
Player 3 14 13
Player 4 14 1

I want to be able to order by the number of games won by the highest played. So in the example above, I would get:

Name Played Won
Player 1 15 14
Player 3 14 13
Player 2 15 5
Player 4 14 1

How can I achieve that?

Thanks in advance.

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2014-10-18 : 05:34:57
[code]select *
from yourtable
order by Played desc
,Won desc[/code]
Go to Top of Page

mole999
Starting Member

49 Posts

Posted - 2014-10-18 : 13:56:16
order by 2 desc, 3 desc

Mole
Go to Top of Page
   

- Advertisement -