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)
 Add row number based on group

Author  Topic 

SuperGhost
Starting Member

12 Posts

Posted - 2008-03-06 : 15:29:27
I need a TSQL statement that can count the number of rows based on the group... In the example I need a way to generate [Count]

I know you can do this with 2005 but unfortunately it must be done in 2000.

-----------------
Col1 | Count
-----------------
1 | 1
1 | 2
1 | 3
-----------------
2 | 1
-----------------
9 | 1
9 | 2

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-06 : 15:36:39
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=98437

Almost exactly what was discussed in this thread. be sure to read Jeff's responses, as his linked article shows a more efficient method than the one I created.



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-03-07 : 03:17:30
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/multipurpose-row-number-function.aspx

Madhivanan

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

- Advertisement -