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 Querying Relational Databases Subqueries Subqueries

Grant Whiting
Grant Whiting
3,645 Points

Question 4 asks me to get a list of all Female customers but I'm told this query doesn't do it:

SELECT s.* FROM Sale AS s INNER JOIN ( SELECT CustomerID FROM Customer WHERE Gender = 'F' ) AS FemaleCustomer ON FemaleCustomer.CustomerID = s.CustomerID;

2 Answers

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Treehouse Project Reviewer

Hi Grant Whiting 👋

Your SQL statement definitely looks valid. I think this is another situation where the back end of this challenge is looking for something specific, or is getting mad with extra things added. In this case, I believe the alias added to all the Sales is what's throwing it off.

This worked for me

SELECT * 
FROM Sale 
INNER JOIN (SELECT CustomerID FROM Customer WHERE Gender = 'F') AS FemaleCustomers 
ON Sale.CustomerID = FemaleCustomers.CustomerID;
Grant Whiting
Grant Whiting
3,645 Points

Ok great, thanks. Looks like the Sale table alias was the issue.