Reputation: 961
i am trying to learn about alias in sql for my course however i do not fully understand the command. As part of the work i must do this:
i have got to here:
SELECT *
FROM SOUNDENGINEER AS s
INNER JOIN MASTERTRACK AS m ON m.EDITED_BY,s.SOUND_ENG_ID;
but now i am stuck please help
Upvotes: 1
Views: 180
Reputation: 961
SELECT * FROM SOUNDENGINEER s INNER JOIN MASTERTRACK m ON m.EDITED_BY = s.SOUND_ENG_ID;
this seems to work
Upvotes: 1
Reputation: 14874
It's correct but ON clause should be like this On m.EDITED_BY=s.SOUND_ENG_ID;
SELECT * FROM SOUNDENGINEER AS s
INNER JOIN MASTERTRACK AS m ON m.EDITED_BY = s.SOUND_ENG_ID;
Upvotes: 5
Reputation: 30498
Almost right. Try:
SELECT *
FROM SOUNDENGINEER AS s
INNER JOIN MASTERTRACK AS m ON m.EDITED_BY = s.SOUND_ENG_ID;
Your use of the comma might suggest you were trying the alternate equi-join syntax, which would be:
SELECT *
FROM SOUNDENGINEER AS s, MASTERTRACK AS m
WHERE m.EDITED_BY = s.SOUND_ENG_ID;
I prefer the former though, as you are explicitly stating that you are joining the tables with an INNER JOIN
statement.
Upvotes: 1
Reputation: 24502
SELECT * FROM SOUNDENGINEER AS s INNER JOIN MASTERTRACK AS m ON m.EDITED_BY = s.SOUND_ENG_ID;
Upvotes: 2