I have three tables and the way they are currently set up violates good
normalization, but I'm having trouble figuring out a better way. Can someone
suggest a more elegant solution?
My tables are:
tblCompanies:
CompanyID - PK
other fields like address, type of business, etc
tblCompanyConta cts:
ContactID- PK
CompanyID - linked to companies (many contacts per company)
other fields like phone, etc
tblJobOrders:
JobOrderID -PK
ContactID - linked to tblCompanyConta cts (many Job orders per Contact)
CompanyID - linked to Companies
other fields containing job order info
The bad normalization happens in the JobOrders table, where I store
both companycontact and company. I originally had only ContactID
in JobOrders, and a JobOrder would know its company by looking at the
company the contact worked for. But the problem bugging me was that if a
Contact person changed companies, the Job order would then point at their
new company, when it should still point to the original company. So I
decided to keep both CompanyID and ContactID fields in JobOrders. In the
form, they will first choose a company and then select from that company's
contact list. If a contact moves companies, the contact field will be
outdated, but at least the company will be correct.
I think there must be a better way ( I hate to compromise on normalization),
but I can't think of it. Any ideas?
thanks in advance
-John
normalization, but I'm having trouble figuring out a better way. Can someone
suggest a more elegant solution?
My tables are:
tblCompanies:
CompanyID - PK
other fields like address, type of business, etc
tblCompanyConta cts:
ContactID- PK
CompanyID - linked to companies (many contacts per company)
other fields like phone, etc
tblJobOrders:
JobOrderID -PK
ContactID - linked to tblCompanyConta cts (many Job orders per Contact)
CompanyID - linked to Companies
other fields containing job order info
The bad normalization happens in the JobOrders table, where I store
both companycontact and company. I originally had only ContactID
in JobOrders, and a JobOrder would know its company by looking at the
company the contact worked for. But the problem bugging me was that if a
Contact person changed companies, the Job order would then point at their
new company, when it should still point to the original company. So I
decided to keep both CompanyID and ContactID fields in JobOrders. In the
form, they will first choose a company and then select from that company's
contact list. If a contact moves companies, the contact field will be
outdated, but at least the company will be correct.
I think there must be a better way ( I hate to compromise on normalization),
but I can't think of it. Any ideas?
thanks in advance
-John
Comment