I have 5 tables with the following structure:Tbl1( Tbl1_ID, DeptID, StartYear, EndYear)Tbl2( Tbl2_ID, Tbl1_ID, StartYear, EndYear)Tbl3( Tbl3_ID, Tbl2_ID, StartYear, EndYear)Tbl3_Term (Tbl3_ID, TermID, Value)Term( TermID, TermName, YearNo)
I am adding a new column to Tbl1, Tbl2 and Tbl3. The modified structure is:Tbl1( Tbl1_ID, DeptID, StartYear, EndYear, OrderNo)Tbl2( Tbl2_ID, Tbl1_ID, StartYear, EndYear, OrderNo)Tbl3( Tbl3_ID, Tbl2_ID, StartYear, EndYear, OrderNo)Tbl3_Term (Tbl3_ID, TermID, Value)Term( TermID, TermName, YearNo)
I want to update the new column in each table based on the DeptID. For all the records associated with a DeptID in Tbl1, I want the OrderNo to be updated as 1, 2, 3, 4,...For the next DeptID in Tbl1 the OrderNo will start with 1, 2, 3 ... again.For Tbl2, the OrderNo for all the records associated with Tbl1_ID should be 1, 2, 3, ....and the same way goes on for each Tbl1_ID in Tbl2.I am not sure how to update this. Any help will be appreciated.Thank you.PKS.