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.
| Author |
Topic |
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-01-08 : 17:40:50
|
| Is there a way to use the Rank function like in 2005 for sql 2000 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-01-08 : 18:48:59
|
You would have create one yourself, which counts and orders and use an identity column perhaps to create psuedo rank. Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-01-08 : 19:17:14
|
another option is something like this. I may not deal with ties the way you want. Also, here is an example of what dataguru may have been referring to:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=94264use pubsselect pub_id ,price ,rank = (select count(*) from titles where pub_id = t.pub_id and isNull(price,0) <= isNull(t.price,0))from titles torder by 1, 3 Be One with the OptimizerTG |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-01-09 : 10:11:16
|
| Thanks I am really new at this and am a little confused. What I have is query that say gets global sales. I need to be able to rank these sales based on what I have gotten from this query how would I use this code? |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-01-09 : 10:46:20
|
| Your question is a little vague. I was hoping you would take the time to understand the concept behind the code I posted so you could apply that to your situation. Perhaps I misunderstood what you need.check out this link.It explains in detail how to formulate a question so you get exactly what you need quickly.http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxBe One with the OptimizerTG |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2008-01-09 : 11:05:02
|
| So how about this, is there away to take the row number that you seen when you run code and put it into a column? |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-01-09 : 13:06:34
|
yes. Did you have any particular table and column in mind?friendly reminder in case you want a more detailed answer.quote: It explains in detail how to formulate a question so you get exactly what you need quickly.http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
btw, your original question "Is there a way to use the Rank function like in 2005 for sql 2000"those ranking functions don't add the rank to any column, they just return it.Be One with the OptimizerTG |
 |
|
|
|
|
|