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

Jack Lee
Full Stack JavaScript Techdegree Student 15,536 PointsHow to use Sequalize to query with "JOIN table ON attr=attr"
Here is the table Schema:
Loans
- id: INTEGER,
- book_id: INTEGER,
- patron_id: INTEGER,
- loaned_on: DATE,
- return_by: DATE,
- returned_on: DATE
I want to query Loans
and its associated tables using sequalize like this:
SELECT
book.title AS book,
patron.first_name||' '||patron.last_name AS patron,
loaned_on,
return_by,
returned_on
FROM loans
JOIN books AS book ON loans.book_id=books.id
JOIN patrons AS patron ON loans.patron_id=patrons.id
More Detailed StackOverflow Question Here
1 Answer

Balazs Peak
46,157 PointsYou don't need to use the "AS" keyword, and the alias once again, in the "JOIN" section. You've already aliased it before, that is enough. I would bet that this is your problem. Hope this helps. Much love!