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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-23 : 16:58:26
writes "Hi there,,

To make it easier to explain, ive a table with TWO columns, the 1st called "Rank" and the 2nd "X", both of them INT type, what i want is to put or arrange the "Rank" column by the highest number in the X" column, meaning that if i sorted the "X" column DESC ill need to put in the "Rank" column number 1, and the 2nd highest number ill put 2 and so on... Ive tried alot but i dont know how to do it so if any one could help me ill be thanksful, email me for any information regarding my question.

Thanks in advance.


Best Regards,

Fady Farhat"

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2006-01-23 : 17:30:27
Did you try adding 2 parts to your order by clause? Does this work for you?

Select Rank, X
From YourTable
Order By X ASC, Rank DESC
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-23 : 18:17:05
>> sorted the "X" column DESC

Select Rank, X
From YourTable
Order By X DESC, Rank DESC


----------------------------------
'KH'

I do work from home but I don't do homework
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-24 : 00:11:10
Otherwise post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -