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 trialFabian Pijpers
Courses Plus Student 41,372 PointsChallenge 2 out of 4 Using Subqueries
SELECT * FROM Sale WHERE SaleAmount IN(SELECT CardID FROM Car WHERE StickerPrice > 30000);
8 Answers
Steven Parker
231,269 PointsWhen it says "Include all columns", that's a hint that you probably want to start with "SELECT *
". Then my first hint was about matching what you are looking for with what the subquery returns. In this case, the subquery is returning "CarId", so the filter clause should start with "WHERE CarID IN...
".
Steven Parker
231,269 PointsI could give a more specific answer if you provide a link to the challenge page, but right off I'd expect that it probably won't be helpful to match a sale amount with a sub query that returns card id's.
You may also want to move this question to the "Databases" category.
Fabian Pijpers
Courses Plus Student 41,372 PointsYou Are right, but i made a mistake because i overlooked database for sql.
Sorry that is a general mistake i made
Steven Parker
231,269 PointsWere you able to resolve your issue from my hint?
And you can still move the question. Click on the rectangle with 3 dots in it and then select "edit question". From there you should be able to pick the topic.
Fabian Pijpers
Courses Plus Student 41,372 PointsI will have to give it a try.
Fabian Pijpers
Courses Plus Student 41,372 PointsDone the category update
Fabian Pijpers
Courses Plus Student 41,372 PointsTrying to change the query so far no luck.
Steven Parker
231,269 PointsSo what do you have now for the query? And please provide a link to the course page.
Fabian Pijpers
Courses Plus Student 41,372 PointsChallenge Task 2 of 4
Use a subquery along with IN to list all sales of cars with Sticker Price greater than $30000. Include all columns.
Fabian Pijpers
Courses Plus Student 41,372 PointsSELECT CarID FROM Sale WHERE SaleID IN(SELECT CarID FROM Car WHERE StickerPrice > 30000);
8 11 10 18 17 16 19 26 31 30
Fabian Pijpers
Courses Plus Student 41,372 PointsFabian Pijpers
Courses Plus Student 41,372 PointsNice Job. Thanks.
Sorry to boughter you i have already solved it.