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

Can I get help with Question 4: Derived Tables?

I have a solution that should work as far as I can tell, but isn't accepted.

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

Please point out what I'm doing wrong.

1 Answer

You do not need the first 'AS' to alias the Sale table. You only need to use AS to name a derived table. Your derived table will need to contain the field you plan to use to JOIN it to another table (CustomerID). Also they want you to select only females into your derived table.