mysql - Using JOIN on several tables matching a foreign key -
I have a dilemma, I want to add them to a long line for each of my 22 tables Company
I have a main table company
which has the reference to CompanyID
as a primary key and 22 other tables which refer to the reference Company.CompanyID
is not the entry of the company in some tables, while others do so, so if I Inner company which does not enter any one of the table does not appear, even if there is no way to show it to anyone?
SELECT * to 'Company' C Inner Join Sale S on S. CompanieID = C. CompaediaID Inner Owner OO CompanId = S For example, in my database I have 5 companies, only 4 of them show up with the above statement because one of them does not have an entry inside the owner. Is I
/ code>.
To remove the duplicate ID, use the section by using the
section:
Join SELECT 'Company' in the left-hand sale S USII Join (Company ID) Officer Owning O Company (Company ID); By using , the segment will produce only one copy of each ID (in the latest versions of MySQL - this behavior has changed over time).
Comments
Post a Comment