So I have this table where I only want to look at AB.
ID CODE COUNT
102 AB 9
101 AB 8
100 AC 23 //not important!!!!
99 AB 7
98 AB 6
97 AB 5
96 AB 0
I want this table to look like this
ID NEWID CODE COUNT
102 102 AB 9
101 101 AB 8
99 100 AB 7
98 99 AB 6
97 98 AB 5
96 97 AB 0
How do I get a new ID which counts consecutively where the code is AB?
This is then used for a SELECT query, the initial table should stay intact, so this is not UPDATING the table but just making a fictive NEWID.