EDIT: Ok, so I managed to get something but it only changes to table on the left side even though I gave 2 specific left joins.

SELECT speler.Roepnaam as team1, wedstrijd.Speler2ID as team2
FROM wedstrijd 
LEFT JOIN speler as player1 
ON wedstrijd.Speler1ID = speler.ID 
LEFT JOIN speler 
ON wedstrijd.Speler2ID = speler.ID WHERE speler.ID
  • Each table copy must have its own alias unique in its visibility scope. – Akina May 26 at 9:29
  • I can't mark it as duplicate because this is from a different site, but that's largely because your question I believe is out of scope here on DBA anyway: stackoverflow.com/questions/19590007/… – Willem Renzema May 26 at 9:33
  • I've tried giving it an alias and it worked, but somehow the right side of the table still hasn't changed from ID to the 'speler' name. – SwitxhFX May 26 at 9:41
SELECT speler1.Roepnaam as team1,     -- unique alias for 1st value from 1st table copy
       speler2.Roepnaam as team2      -- unique alias for 2nd value from 2nd table copy
FROM wedstrijd 
LEFT JOIN speler as speler1           -- unique alias for 1st table copy
ON wedstrijd.Speler1ID = speler1.ID   -- join this 1st copy by its alias
LEFT JOIN speler as speler2           -- unique alias for 2nd table copy
ON wedstrijd.Speler2ID = speler2.ID   -- join this 2nd copy by its alias 

| improve this answer | |
  • It worked, you're a legend – SwitxhFX May 26 at 10:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.