chasm24 Posted May 31, 2005 Posted May 31, 2005 I have a table with records of companies. some companies are related to others (like subsidiaries) and i want to be able to show this connection. i also want to show a connection between subsidiaries but don't want to be bogged down with manually inputting primary keys among 10 subsidiaries so that all the companies show up in each other's portals. any suggestions on how to proceed?
Ender Posted May 31, 2005 Posted May 31, 2005 If you add a "Parent Company ID" field to the table, you can add a second TO of Company for the "Subsidiaries", where the relationship is based on Company::CompanyID = Subsidiary::Parent Company ID. To see the other companies with the same parent company, use a third TO of Company for "Same Parent", where the relationship is based on Company::Parent Company ID = Same Parent::Parent Company ID AND Company::Company ID <> Same Parent::Company ID.
chasm24 Posted June 1, 2005 Author Posted June 1, 2005 so i need to give parent companies two primary keys? Company ID and Parent Company ID?
Ender Posted June 1, 2005 Posted June 1, 2005 Company ID is the primary key, Parent Company ID is the foreign key in the self-join relationship.
Recommended Posts
This topic is 7172 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now