Tuesday, 27 August 2013

tSQL While looping same table on 2 fields

tSQL While looping same table on 2 fields

I am trying to add incremental counting to 2 separate columns.
I have FieldA and FieldB in the same table and need to increment as in
this example:
FieldA ID1 FieldB ID2
ABC 1 GREEN 2
ABC 1 RED 3
ABC 1 Yellow 4
XYZ 5 RED 6
DEF 7 GREEN 8
DEF 7 BLUE 9
Where no number is duplicated except for FieldA and FieldA will increment
depending on the last of FIELDB.

No comments:

Post a Comment