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 trial

Databases

It's telling me that I need a 3rd INNER JOIN but I'm unsure what else I should be joining.

It's also not getting the VIN

5 Answers

Carlos Alberto Del Cueto Carrejo
Carlos Alberto Del Cueto Carrejo
13,817 Points

I would suggest using AS to name give a different name to the tables, not the columns, it's less confusing, could be useful for a report. Now the actual problem is that you were not joining the Car table. On that step 2 of the exercise there are three tables. Here is the solution, hope it helps you to solve the next steps ;) . You can always ask again if you find yourself in trouble once more.

SELECT MakeName, ModelName, VIN, StickerPrice FROM Make AS mk
INNER JOIN Model AS md ON mk.MakeID = md.MakeID
INNER JOIN Car AS c ON md.ModelID = c.ModelID
ALBERT QERIMI
ALBERT QERIMI
49,872 Points

please share syntax too we can not help you

I checked the box to attach my code, but I guess it didn't do that. sorry. Here's my code: SELECT ModelName AS "Model Name", VIN, StickerPrice AS "Sticker Price" FROM Model INNER JOIN Car ON Model.ModelID = Car.ModelId;

I checked the box to attach my code, but I guess it didn't do that. sorry. Here's my code: SELECT ModelName AS "Model Name", VIN, StickerPrice AS "Sticker Price" FROM Model INNER JOIN Car ON Model.ModelID = Car.ModelId;

Carlos Alberto Del Cueto Carrejo
Carlos Alberto Del Cueto Carrejo
13,817 Points

By your comment I can see that you are trying to relate both tables by joining the ModelID column on each of them, but on the Car table you are misspelling it, you are calling ModelId no ModelID. Can you add a link to the coding challenge ?

https://teamtreehouse.com/library/querying-relational-databases/joining-table-data-with-sql/join-queries

SELECT MakeName AS "Make Name", ModelName AS "Model Name", VIN, StickerPrice AS "Sticker Price" FROM Model INNER JOIN Make ON Make.MakeID = Model.MakeID

SQL Error: no such column: VIN

ALBERT QERIMI
ALBERT QERIMI
49,872 Points

first of all it is a bug on atach code with challange i will report it it happend me to

here is sulotion for 1/4 challange you need to join two table in one coulumn that both tables have second i see you used AS many times AS is not required here AS is like SELECT fristName , lastName AS "FullName" and will display first and last name together AS FULLNAME .

Check Work

> SELECT ModelName , VIN , StickerPrice FROM Model INNER JOIN Car ON model.ModelID = car.CarModelID;