SQLTeam.com | Weblogs | Forums

Sql joins

Hi all.
I am a complete newby with SQL and I have hit a (logic) wall :neutral_face:
I am working through this online course at sql-easy dot com and am on the shown topic: multiple joins.
So far I have powered through the topics with great success but now for the life of me, I can not figure out the multiple join syntax....
any help would be GREATLY appreciated.
Thanks
ps - my current output is this:
Result:

name name
Doogie Howser Alyson Hannigan
Doogie Howser Alyson Hannigan
Doogie Howser Neil Patrick Harris
Doogie Howser Neil Patrick Harris
Barney Stinson Alyson Hannigan
Barney Stinson Alyson Hannigan
Barney Stinson Neil Patrick Harris
Barney Stinson Neil Patrick Harris

But should be this:
Expected Result:

name name
Doogie Howser Neil Patrick Harris
Barney Stinson Neil Patrick Harris
Lily Aldrin Alyson Hannigan
Willow Rosenberg Alyson Hannigan

You need to use DISTINCT in your select query to remove the duplicates.

Thanks for the response - I actually resolved it before I saw your response...
Cheers
This was the final correct code(but probably doesn't mean much if you're not on the tutorial lol):
SELECT character.name, actor.name
FROM character
INNER JOIN character_actor
ON character_actor.character_id = character.id
INNER JOIN actor
ON character_actor.actor_id = actor.id;