canuckconsulting
asked on
SQL Update records with their occurance with a group
I have a t-SQL problem I can't get my head around. I have a table of orders with each order having a unique alpha OrderNo. Each order is associated with a BaseOrder in a many to one relation ship (one baseorder can have multiple orders).
The issue I have is I need to update the table and set a column to indicate the count of the order within the associated base order. The example below indicates what I am after. Orders 10001, 10012, 10018 and 1001A are all associated with BaseOrder 10001. I need to update the SubOrderNumber with 1, 2, 3, 4 respectively as I want them stamped in incremental order based on their alpha sort order.
The issue I have is I need to update the table and set a column to indicate the count of the order within the associated base order. The example below indicates what I am after. Orders 10001, 10012, 10018 and 1001A are all associated with BaseOrder 10001. I need to update the SubOrderNumber with 1, 2, 3, 4 respectively as I want them stamped in incremental order based on their alpha sort order.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks,
Scott