How could I make this run faster considering there are a lot of rows and combinations to check?
J K O W
1jobid dep job_no Sequence
2 aaa FJ 1 1 <existing data>
3 aaa FJ 1 2
4 aaa FJ 1 5
5 aaa RJ 1 1
6 aaa RJ 1 9
7 aaa RJ 1 10 <existing data>
-----------------------------------------------------
8 aaa RJ 1 11 <after the code is run>run, 11 is assigned>
9 aaa FJ 1 6 <after the code is run>run, 6 is assigned >