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
Boncom Boncom
8,906 PointsJoining Tables and Aliasing 2: Can't INNER JOIN
I know I could just continue with the course, but I cannot figure out why this:
SELECT movies.title genres.name FROM movies INNER JOIN genres ON movies.genre_id = genres.id WHERE name IS NOT null;
Isn't working for the following:
We have a 'movies' table with a 'title' and 'genre_id' column and a 'genres' table has an 'id' and 'name' column. Use an INNER JOIN to join the 'movies' and 'genres' tables together only selecting the movie 'title' first and the genre 'name' second.
What do I have wrong? The error message isn't helping me identify what I have wrong:
09dda397-4180-46ab-b673-3935d84179ed.rb:38:in `eval': undefined method `to_a' for # (NoMethodError) from 09dda397-4180-46ab-b673-3935d84179ed.rb:38:in `eval' from 09dda397-4180-46ab-b673-3935d84179ed.rb:38:in `
2 Answers
Joe Timmons
4,331 PointsJust a missing comma between your fields in the SELECT statement.
SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id = genres.id WHERE name IS NOT null;
Boncom Boncom
8,906 PointsDOH! Thanks.
βTod