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

Query doesn't select the columns correctly.

I'm trying to use the LEFT OUTER JOIN. It works but I keep getting a warning says 'your query doesnt select SaleDate, SaleAmount, FirstName and LastName correctly.' This is the code I wrote.

SELECT sa.SaleID, sa.SaleDate, sa.SaleAmount, sa.SalesRepID, sr.FirstName, sr.LastName, sr.SalesRepID FROM Sale AS sa LEFT OUTER JOIN SalesRep AS sr ON sa.SalesRepID = sr.SalesRepID;

1 Answer

Ashley Carpenter
Ashley Carpenter
13,393 Points

Try doing the below. It could be that it only wants these fields and not all the extras you included.

SELECT sa.SaleDate, sa.SaleAmount, sr.FirstName, sr.LastName 
FROM Sale AS sa 
LEFT OUTER JOIN SalesRep AS sr 
ON sa.SalesRepID = sr.SalesRepID;