I have a table Employee, another table Department and a relational table:
Employee Table
id Name
1 A
2 B
3 C
4 D
5 E
6 F
Department Table
id Name
1 Accounting
2 Finance
Relation Table
id EmployeeId DepartmentId
I want to make a dynamic query to be able to distribute in my relational table same quantity of employee for each department, I know that I can use cross join but is going to put all employees in each department. I just want the distribution, for example 3 employees for Account and the other 3 for finance, but this quantity could change. Thanks