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
 Transact-SQL (2000)
 Identity column by a group

Author  Topic 

jstrangeway
Starting Member

9 Posts

Posted - 2004-10-21 : 15:39:33
Hello, I have a question on getting a table to a point that I can pivot it. The following is an example of the data
I have
id diag count
1 42 75
1 49 50
1 38 22
2 70 48
2 33 27


You will notice they are in descending order by count. I need the following I think to be able to cross tab it.
id diag count rank
1 42 75 1
1 49 50 2
1 38 22 3
2 70 48 1
2 33 27 2

How do I get the rank field populated and reset to 1 for each new id? Is there an easy way to do this?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-22 : 09:19:19
take a look:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=41610

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -