Snowflake68
Registered User.
- Local time
- Today, 11:58
- Joined
- May 28, 2014
- Messages
- 452
I have a table which has two fields with a stock code multiple times together with an operation number in ascending order for each of the lines. I then need to generate a new number in the 'Final Op' field incremented by 1 up to the last line for that stock code and then start again at 1 for the next stock code and so on. I have hundreds of stock codes so doing this manually is not an option plus I need to automate this so someone can run it again in the future.
I dont know how to write the code myself so I wondered if someone could write the code for me please. I would be extremely grateful.
For example
StockCode OperationNumber FinalOp
100000 201 1
100000 202 2
100000 203 3
100000 204 4
100000 205 5
100001 201 1
100001 202 2
100001 203 3
100001 204 4
100001 205 5
100001 206 6
100001 301 7
100002 201 1
100002 202 2
100002 203 3
100002 204 4
100002 205 5
100002 206 6
100002 301 7
100002 302 8
Thanks in advance.
Attached is the full table I have.
I dont know how to write the code myself so I wondered if someone could write the code for me please. I would be extremely grateful.
For example
StockCode OperationNumber FinalOp
100000 201 1
100000 202 2
100000 203 3
100000 204 4
100000 205 5
100001 201 1
100001 202 2
100001 203 3
100001 204 4
100001 205 5
100001 206 6
100001 301 7
100002 201 1
100002 202 2
100002 203 3
100002 204 4
100002 205 5
100002 206 6
100002 301 7
100002 302 8
Thanks in advance.
Attached is the full table I have.