Sorry, but I don't understand!
Why Table1 and Table2? I have only the Personnel (or Employees) table with (f.e.) the following field:
A Manager also belongs to the Personnel (or Employees) table. Into the underlying db, it exist an auto-reference for the Personnel table.
I think you have to split information on twpo distinct tables, one for employees, and the other just for managers, try something like that :
load EmployeeCode, ManagerCode, otherInfo... from where you want
load Distinct ManagerCode resident employee;
left join load EmployeeCode as ManagerCode, otherInfo as managerOtherInfo resident employee;
pscorca69 wrote: Hi, I'm a beginner with QV. Do you think or are you sure?
This case occurs frequently. Is there a best practice to manage it?
Separating managers and employees into two different tables is one option. However, out in the real world with real organization hierarchies, I'm guessing that won't tie your data together the way you want.
You could probably use a hierarchy load on the data. I haven't used hierarchy loads outside of a few test cases, but it could probably be used to store an organization hierarchy.
You could use a semantic load on the data. Everyone would be stored as employees, and you'd also store the relationship between employees, such as the manager->managed relationship. You can then navigate through the "hierarchy" by following these semantic links up and down.
I'm sure there are other options as well. Best practice depends on your exact requirements.
I want to simply translate the Employees-Managers relation in QV. In SQL Server, generally it is enough to create a Employees entity or table with Employee Code as PK and Manager Code as the FK to link the Employee code, generating an auto-refers relationship. In QV, the relations are created by the field naming.