jtakkinen_82 Posted March 2, 2008 Share Posted March 2, 2008 Hey, I have this database where I need a many-to-many relationship between 2 tables (project and teams). So the tables are as follows: --------------- teams | --------------- teamID name --------------- projects | --------------- projectID name --------------- projects_teams| --------------- teamID projectID --------------- So what I need is a mysql query to find all teams that are related to specific project using the intermediate table... how can this be done? Link to comment https://forums.phpfreaks.com/topic/94059-mysql-and-many-to-many-search/ Share on other sites More sharing options...
fenway Posted March 4, 2008 Share Posted March 4, 2008 I assume you mean team names? select p.name, t.name from project_teams as pt inner join teams at t on ( t.teamID = pt.teamID ) inner join projects as p on ( p.projectID = pt.projectID ) where pt.projectID = 5 Link to comment https://forums.phpfreaks.com/topic/94059-mysql-and-many-to-many-search/#findComment-482862 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.