connect multiplie tables with more then once the same key.
Prinicipaly, i try to get around loops by having the joining key in all the tables. Sometimes i make the tables join on a dummy, hard coded key. But in your schema that won't work.
Add person id to the companies table (maybe just left join to the contacts table and bring the contact's person_id in). You will then get Person Id & Contact Id as join keys between all 3 tables. There will be no loops anymore and your app should work.
Not tested this. So don't bite my head off if it doesn't work.
AW:connect multiplie tables with more then once the same key.
normally I would expect that a company table has one record per company (for each company) and a company_id is stored in the person table as a reference (foreign key). In this case you would'nt need to have a contact_id in the company table and everything goes fine in QV.
In your case you have a huge amount of redundant data in the company table...
If this structure resides in your database than you can transform this via SQL in the load script.