I have no clue how to do this and was wondering if someone had an idea. I've got a table which has three fields--cart_id, order, and orderid. The cart_id field has the number of the cart (1, 2, 3, etc.), and the order field has a random order number which is on that cart. So it looks something like:
CART_ID ORDER ORDERID
1 123456
1 123457
1 123458
2 123459
2 123460
2 123461
3 123462
3 156123
3 159987
I want to update the ORDERID field with the sequential number of the order on that particular cart. So, the above example would look like 1,2,3,1,2,3,1,2,3,1,2,3 (order number 123461's orderid would be 3 since it's the 3rd order in the 2nd cart). The are always only three orders on a cart.
Any ideas?
CART_ID ORDER ORDERID
1 123456
1 123457
1 123458
2 123459
2 123460
2 123461
3 123462
3 156123
3 159987
I want to update the ORDERID field with the sequential number of the order on that particular cart. So, the above example would look like 1,2,3,1,2,3,1,2,3,1,2,3 (order number 123461's orderid would be 3 since it's the 3rd order in the 2nd cart). The are always only three orders on a cart.
Any ideas?