shadowfoxmi Posted June 29, 2006 Share Posted June 29, 2006 Hello, I have a query with two joins on three tables. Here's the scenario. First table - >ProjectsSecond table - >[Team Members]Third Table - >Roles and I have the join lik thisprojects join [team members] join roles(of course i have the correct syntax with the field names n stuff in my query) Let's say I'm trying to print Project Name, Team Member Name, Role Name it works fine. Now i hav a filter saying Role Name="Product Manager" That works fine too. The problem is since it is a equality condition, it is listing only the Project Names with a "Product Manager" in the team. But I want to be able to select all the projects listing the "Product Manager" and in case a team didn't have a "Product Manager", have null returned for Role Name and Team Member Name.I have tried all join options (left, right, full) ; nothing works because i'm trying to filter on "Product Manager". Any help on this would be greately appreciated.Thanks for your time. Quote Link to comment https://forums.phpfreaks.com/topic/13211-problem-with-join/ Share on other sites More sharing options...
Barand Posted July 1, 2006 Share Posted July 1, 2006 I can't test this as I don't have access to SQL Server at home. Try[code]SELECT p.name, t.name, r.nameFROM Projects pLEFT JOIN ([team members] t INNER JOIN Roles r ON t.roleID = r.roleID AND r.name = 'Product Manager')ON p.projectID = t.projectID[/code] Quote Link to comment https://forums.phpfreaks.com/topic/13211-problem-with-join/#findComment-51739 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.