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 trialShawn Jass
7,151 PointsTrying to get the code corrected
Select name.FirstName, name.LastName, Sale.SaleID, Sale.SalesRepID, Sale.SaleAmount from Sale inner join Model on Sale.SaleAmount
1 Answer
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsThat is task 2 of challenge https://teamtreehouse.com/library/querying-relational-databases/subqueries/subqueries
First we cannot use the JOIN
in this challenge.
We need to used IN
only.
How did you solve first task? Take a look at this guy solution, he also explains logic:
https://teamtreehouse.com/community/help-with-challenege-1-of-4
So the constraint of the Task 2 is exactly like in Task 1:
- use only one subquery with
IN
keyword where you select foreign_key
So the solution will look like this
select everything from sale
in where condition we write
IN
and subquery that selectsCarId
fromCar
with price > 30000.
SELECT * FROM Sale
WHERE CarId IN (
SELECT CarId
FROM Car
WHERE StickerPrice > 30000
);
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsHey Shawn,
You will need to provide a direct link to the challenge you are referring to, in order for us to be able to accurately help you troubleshoot what is wrong.