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

Amir Eskandari
Amir Eskandari
9,153 Points

Subquery Question..

Can somebody tell me what's wrong with my query? I believe I'm returning the right rows and columns but I must be missing something in the question..

Thanks!

SELECT s.* 
FROM Sale s 
INNER JOIN (SELECT * FROM Customer WHERE gender = 'F') c ON c.CustomerID = s.CustomerID

1 Answer

Steven Parker
Steven Parker
231,248 Points

But just taking a wild guess, the challenge might be asking you to create a query that uses a subquery, or one that uses a JOIN, but perhaps not both.

Based on your question title, I'll go one step further and guess that the challenge wants you to create a subquery that returns only the CustomerID and use it as part of a WHERE clause instead of a JOIN.