runnerjp Posted February 2, 2016 Share Posted February 2, 2016 (edited) I am trying to join 3 tables together using the following sql command: SELECT tg.Kickoff, tg.League, tg.home, tg.away, ln.Full, ln.Mysite, ln.Country, tl.mydb FROM `todaysgames` AS tg INNER JOIN `leaguenames` AS ln ON tg.League = ln.Othersites INNER JOIN `teamlookup` AS tl ON tg.home = tl.websitedb OR tg.away = tl.websitedb; The issue is I get is it doubles each row. What I am looking to do is for each tg.home and tg.away is replace it with the tl.websitedb (this basically amends the name). would this be possible? (Below is the current output) And here is the desired output Edited February 2, 2016 by runnerjp Quote Link to comment Share on other sites More sharing options...
Barand Posted February 2, 2016 Share Posted February 2, 2016 You need to join twice to teamlookup using different aliases INNER JOIN `teamlookup` AS tlh ON tg.home = tlh.websitedb INNER JOIN `teamlookup` AS tla ON tg.away= tla.websitedb Quote Link to comment 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.