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 2005 Forums
 Transact-SQL (2005)
 How to implement ranking functions with case

Author  Topic 

thendraljazz
Starting Member

26 Posts

Posted - 2011-11-09 : 04:15:25
I have basic idea about ranking function.but i want to know ranking function with case with example.

Thanks
Thendral

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-09 : 04:27:49
what do you mean by that. Can you show some sample data to illustrate how you want to do case based ranking?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

thendraljazz
Starting Member

26 Posts

Posted - 2011-11-09 : 04:31:33
Thats ok.I just want to know about ranking functions with example.
Can you..
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-09 : 04:38:00
something like stub below untill i know more on your table,columns and scenario


SELECT RANK() OVER (PARTITION BY somecolumn ORDER BY CASE Somecondition WHEN somevalue THEN somefield WHEN someothervalue THEN someotherfield END ASC) AS Rnk,columns..
FROM table


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

thendraljazz
Starting Member

26 Posts

Posted - 2011-11-09 : 04:40:18
ok.thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-09 : 04:42:57
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -