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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Tyler McDougal](https://secure.gravatar.com/avatar/af8ea32a2054245051c8c18b98f0013b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tyler McDougal
2,549 PointsI Need help trying to solve this:
In a car database there is a Model table with columns, ModelID, MakeID and ModelName and a Car table with columns, CarID, ModelID, VIN, ModelYear and StickerPrice. Show all Model names from the Model table along with VIN from the Car table. Make sure models that aren’t in the Car table still show in the results!
![Tyler McDougal](https://secure.gravatar.com/avatar/af8ea32a2054245051c8c18b98f0013b?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tyler McDougal
2,549 PointsSELECT ModelName, VIN FROM Model LEFT OUTER JOIN Car ON Model.ModelName = Car.CarID INNER JOIN Car ON Car.ModelID = Model.ModelID;
![Tyler McDougal](https://secure.gravatar.com/avatar/af8ea32a2054245051c8c18b98f0013b?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tyler McDougal
2,549 Points2 Answers
![Umesh Ravji](https://secure.gravatar.com/avatar/decd387aa640da9f35ea98d0411098fa?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Umesh Ravji
42,386 PointsHi Tyler, you're almost there.
FROM Model
LEFT OUTER JOIN Car ON Model.ModelName = Car.CarID
The two columns ModelName
and CarID
are not related, so it doesn't make much sense to perform a join using the two.
INNER JOIN Car ON Car.ModelID = Model.ModelID;
This is exactly the part you need for your LEFT OUTER JOIN
, so once you replace the first unnecessary join with this one (and make sure it is an LEFT OUTER JOIN
, you have your answer :)
SELECT ModelName, VIN
FROM Model
LEFT OUTER JOIN Car ON Car.ModelID = Model.ModelID;
![Tyler McDougal](https://secure.gravatar.com/avatar/af8ea32a2054245051c8c18b98f0013b?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tyler McDougal
2,549 PointsWOW!! I See where I messed up. Thanks Alot!
![james south](https://uploads.teamtreehouse.com/production/profile-photos/7686112/micro_abstract2.jpg)
james south
Front End Web Development Techdegree Graduate 33,271 Pointsit's asking you to use a type of join that includes records even if they don't have a match, so focus on that. the two tables have a common column that is used to join them.
Umesh Ravji
42,386 PointsUmesh Ravji
42,386 PointsWhat have you written so far? Share it with us :)