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

Alan Mills
Alan Mills
31,712 Points

Not sure what I'm missing on question 4.

The task is to select all of Sale table, where customer gender = 'F'. And to execute this with a temp table. And based on errors I'm getting, I need to use an INNER JOIN. But somehow, I'm not getting Every Customer documented as 'F'. I can't use a RIGHT (in this case) JOIN.... So, what am I missing? Thanks for the time.....

Steven Parker
Steven Parker
231,236 Points

Please show your complete query, and provide a link to the course page to facilitate analysis.

Alan Mills
Alan Mills
31,712 Points

Sorry, I assumed that checkbox labeled to "include your code" was going to submit it. Thanks for your time!

Select S.* FROM Sale S INNER JOIN (SELECT CustomerID FROM Customer WHERE Gender='F') AS Gen ON S.CustomerID = Gen.CustomerID;

3 Answers

Steven Parker
Steven Parker
231,236 Points

You're very close. Just select "*" instead of "S.*".

Alan Mills
Alan Mills
31,712 Points

So, now I'm using the following: SELECT * FROM Sale AS S INNER JOIN (SELECT CustomerID, Gender FROM Customer WHERE Gender = 'F') AS f ON S.CustomerID = f.CustomerID; Current error is that I'm not using the "ON" Keyword.
Any ideas? I'm confident on SQL Server Mgmt Studio I'd be fine. But, I'd like to know if I'm overlooking somethng. Thanks again for your time!

Steven Parker
Steven Parker
231,236 Points

Why did you add "Gender" to the SELECT clause of the subquery? Try it without that as you had before.

If that's not it, please provide a link to the course page.

Alan Mills
Alan Mills
31,712 Points

I was trying various add'l things in order be done with this question. https://teamtreehouse.com/library/querying-relational-databases/subqueries/subqueries Question 4 is the question of interest.

Steven Parker
Steven Parker
231,236 Points

Use your original code and apply first suggestion of selecting "*" instead of "S.*" (with no other changes).