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 trialAJ Longstreet
Treehouse Project ReviewerUsing 2 Inner Joins at the same time?
How do I use 2 joins at once? I'm getting a syntax error (Missing Operator).
SELECT Rentals.RentalDate, Rentals.Due, Customers.lastname, Customers.firstname, Media.ItemTitle FROM Rentals INNER JOIN Customers ON Rentals.Customer = Customers.ID INNER JOIN Media ON Rentals.Media = Media.ItemTitle WHERE Date() > Rentals.Due;
AJ Longstreet
Treehouse Project ReviewerIt's a little project I'm working on in Microsoft Access. It's driving me nuts :-P
Steven Parker
231,271 PointsIn that case, can you show the DDL?
1 Answer
Steven Parker
231,271 PointsJust a wild guess.
Without seeing the challenge, I'm just wondering if that last join should be:
... INNER JOIN Media ON Rentals.Media = Media.ID ...
It would make sense if the Media table were constructed like the Customers table.
AJ Longstreet
Treehouse Project ReviewerI did change it to that. It works with either INNER JOIN but not with Both
AJ Longstreet
Treehouse Project ReviewerIt turns out the MS Access requires Brackets with multiple join statements.
Thank you for helping me work through it!
SELECT Rentals.RentalDate, Rentals.Due, Customers.lastname, Customers.firstname, Media.ItemTitle FROM ((Rentals INNER JOIN Customers ON Rentals.Customer = Customers.ID) INNER JOIN Media ON Rentals.Media = Media.ID) WHERE Date() > Rentals.Due;
Steven Parker
231,271 PointsI knew it did that if you use the query builder, but I didn't think they were actually required for it to run.
Steven Parker
231,271 PointsSteven Parker
231,271 PointsCan you provide a link to the challenge? The query syntax looks good, but perhaps there's some specific requirement of the challenge that is not being met.