Sample Data Table "Assign" EmpID Billing_ID 1 5 2 5 3 7 4 7 Table "Accounts" ID Account Dollar Billing_ID Employee_ID 1 1234 99000 5 2 4144 95000 5 3 2525 90000 5 4 5151 85000 5 5 5151 90000 7 6 5141 85000 7 8 6666 80000 7 9 7777 75000 7 Table "Accounts" Required Result: ID Account Dollar Billing_ID Employee_ID 1 1234 99000 5 1 2 4144 95000 5 2 3 2525 90000 5 1 4 5151 85000 5 2 5 5151 90000 7 3 6 5141 85000 7 4 8 6666 80000 7 3 9 7777 75000 7 4 When you sort above result, Employee_ID wise, you will notice that accounts are distributed equally to all employees: Table "Accounts" Required Result: ID Account Dollar Billing_ID Employee_ID 1 1234 99000 5 1 3 2525 90000 5 1 2 4144 95000 5 2 4 5151 85000 5 2 5 5151 90000 7 3 8 6666 80000 7 3 6 5141 85000 7 4 9 7777 75000 7 4 Hope it clarifies. Thanks and regards