I have a table of companies and I have a table of competencies and a joining table; companies_competencies
I'm trying to get all companies where they are linked to all competencies in a certain data set.
So for example I need to get all companies that have the competencies 1,2 and 3.
I've started with this query:
SELECT companies.id, companies.name FROM companies, companies_competencies
WHERE companies.id = companies_competencies.companies_id
AND companies_competencies.competency_id IN(1,2,3)
GROUP BY companies.id
This gives me all companies that have 1 or many of the competencies, but I'm trying to get companies that specifically have all of them.