PHP MySQL join help
I have 3 tables, companies, industries and company_industry.
In companies, I store information about companies and in industries there's some common industries to attach to the company. So in the table company_industry I store the ID of the company and the industry.
My problem is that I want to do a full开发者_JAVA百科text search of the company including the industry. I know it has something to do with join, but this is far to advanced than I can handle.
The full text search I'm not so sure about, but the JOIN is fairly easy.
SELECT * FROM company JOIN company_industry ON company.id = company_industry.company JOIN industry ON company_industry.industry = industry.id;
As a side note, unless a company can be part of multiple industries, the company_industry table is not required.
精彩评论