this.user Posted March 6, 2011 Share Posted March 6, 2011 I have three tables team id player team_id supply team_id player table has the following data: Mike, tom, john, joe supply table has the following data: bat, glove, hat when i run this query, i get repeat values back, how do i make this unique, so each value from each table appears once. 'SELECT DISTINCT team.*, player.name, supply.name FROM team LEFT JOIN player ON(player.team_id=team.id) LEFT JOIN supply ON(supply.team_id=team.id) WHERE team.id="43"'; player: mike, mike, mike, tom, tom, tom, jon, jon, jon, joe, joe, joe supply: bat, glove, hat, bat, glove, hat, bat, glove, hat, bat, glove, hat i would like this result instead player: mike, tom, jon, joe supply: bat, glove, hat Quote Link to comment https://forums.phpfreaks.com/topic/229734-issue-with-left-join-query/ Share on other sites More sharing options...
kickstart Posted March 6, 2011 Share Posted March 6, 2011 Hi What it has brought back is each player several times, once for each piece of equipment. As each row will have a player and a piece of equipment I do not see how you intend to have 4 players and 3 pieces of equipment. I looks like what you need is 2 separate queries. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/229734-issue-with-left-join-query/#findComment-1183503 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.