Hey all --
Here's the thing:
I have a table with two fields in it:
cd --
buf7 --
buf7 is a number that repeats for many records before it increments (it identifies accounts, and accounts have several units, which share buf7 as an identifier) --
What I need is a sql command that will go through the table and increment a number in the cd column only when the buf7 number changes. Basically, it's like an autonumber, but changes only when the buf7 does.
So, If I now have:
cd buf7
1234567
1234567
1234567
1234568
1234568
I want the command to make it:
cd buf7
1 1234567
1 1234567
1 1234567
2 1234568
2 1234568
And before you say to run an
UPDATE table SET cd=1 WHERE buf7=1234567
Let me say that there are thousands of unique buf7's, so this method would be horribly inefficient (not to mention boring).
Thanks for any help!
Paul Prewett
Here's the thing:
I have a table with two fields in it:
cd --
buf7 --
buf7 is a number that repeats for many records before it increments (it identifies accounts, and accounts have several units, which share buf7 as an identifier) --
What I need is a sql command that will go through the table and increment a number in the cd column only when the buf7 number changes. Basically, it's like an autonumber, but changes only when the buf7 does.
So, If I now have:
cd buf7
1234567
1234567
1234567
1234568
1234568
I want the command to make it:
cd buf7
1 1234567
1 1234567
1 1234567
2 1234568
2 1234568
And before you say to run an
UPDATE table SET cd=1 WHERE buf7=1234567
Let me say that there are thousands of unique buf7's, so this method would be horribly inefficient (not to mention boring).
Thanks for any help!
Paul Prewett