Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChris Gauthier
Courses Plus Student 6,434 PointsInteresting problem (to me, anyway). Im know I need 3 joins, but im not sure whats wrong with this. Can you help?
Have I made a mistake in the syntax of these queries?
Chris Gauthier
Courses Plus Student 6,434 PointsWoops, i thought I had checked include code. Anyway, here we go:
select Make.MakeName,Model.ModelName,Car.VIN,Car.StickerPrice from Make inner join on Make.MakeId = Model.MakeId inner join Model.modelid = car.modelid
Can you help me fix this and comment as to what happened?
Thanks
2 Answers
KRIS NIKOLAISEN
54,972 PointsThis should make it easier to see. Your code is on top. The revised code is on bottom.
select Make.MakeName,Model.ModelName,Car.VIN,Car.StickerPrice
from Make
inner join on Make.MakeId = Model.MakeId
inner join Model.modelid = car.modelid
SELECT Make.MakeName,Model.ModelName,Car.VIN,Car.StickerPrice
FROM Make
INNER JOIN Model ON Make.MakeId = Model.MakeId
INNER JOIN Car ON Model.modelid = car.modelid;
Your inner joins need to include the table name to join and the keyword ON to specify what columns are joining.
Chris Gauthier
Courses Plus Student 6,434 Pointsah that was a silly mistake lol.
But also, another note to your solution (so that other's don't get confused -- and it was a second mistake i made up above):
Note, Make.MakeName was not asked for in the query, and the query will not pass until it is removed.
Thanks very much for your help Chris
SELECT Model.ModelName,Car.VIN,Car.StickerPrice
FROM Make
INNER JOIN Model ON Make.MakeId = Model.MakeId
INNER JOIN Car ON Model.modelid = car.modelid;
KRIS NIKOLAISEN
54,972 PointsKRIS NIKOLAISEN
54,972 PointsCan you post your SQL?