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!
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
Kenzie Iles1,773 Points
Error: near "ID": syntax error
I have scanned this query multiple times and can't figure out what is wrong, can someone help?
SELECT sr.LastName, Loc1.StLouisAmount, Loc2.ColumbiaAmount From SalesRep AS sr Left Outer Join (Select SalesRepID, Sum(SaleAmount) as StLouisAmount From Sale AS s where s.LocationID = 1 Group By SalesRep ID) As Loc1 ON sr.SalesRepID = Loc1.SalesRepID Left Outer Join (Select SalesRepID, Sum(SaleAmount) as ColumbiaAmount From Sale AS s where s.LocationID = 2 Group By SalesRep ID) AS Loc2 ON sr.SalesRepID = Loc2.SalesRepID;
Steven Parker224,848 Points
This code has "Group By SalesRep ID" (with a space in the column name) instead of "Group By SalesRepID". This occurs twice in the query.