| SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it. |
|
|||
Row Number Each GroupHi...!
To a similar table I need to add a row number... Code:
GRP RowNR 73463 1 73463 2 73463 3 73463 4 53246 1 53246 2 78843 1 43543 1 43543 2 43543 3 43543 4 43543 5 With ROW_NUMBER() OVER() is like a sequence but doesn't work for each group... Thanks in advance and regards...! |
|
|||
|
Hi hail...!
Here the solution (DB2):
SELECT C.CTA, ROW# In this T-SQL CTA1 is another field different that CTA. Follow next link for 2 ways in SQLServer: tek-tips forums Best regards...! |