Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

I am having problems with joining tables and aliasing, challenge 1

I am having problems with joining tables and aliasing, challenge 1.

I am confident I have the right answer and I've even used the three different formats shown to me on the MYSQL 5.0 manual, but I keep getting an error and its telling me this...

You're not retrieving the movie 'title' first and the genre 'name' second. Use an INNER JOIN. I am having problems with joining tables and aliasing, challenge 1.

I am confident I have the right answer and I've even used the three different formats shown to me on the MYSQL 5.0 manual, but I keep getting an error and its telling me this...

You're not retrieving the movie 'title' first and the genre 'name' second. Use an INNER JOIN.

here is a copy of the answer I put in.

SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.title = genres.name;

PLEASE HELP ME...

here is a copy of the answer I put in.

SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.title = genres.name;

PLEASE HELP ME...

3 Answers

Looks like you're trying to relate the data using the movie title and genre name but those two columns aren't likely to have records that are ever equal to each other. What you want to do instead is join the two tables when the genre ids are equal.

Try this!

SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id = genres.id;
Oriyomi Alimi
Oriyomi Alimi
2,305 Points

Hi Katie,

I am actually putting that exact code syntax in and still getting the same error as the OP.
"SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id = genre.id; "

What am I missing?

lordcozycat
lordcozycat
11,940 Points

Hi there!

I've just tried out Katie's answer, and it works perfectly for me. Have you tried refreshing the page or clearing your history? I know that sometimes Challenges will refuse to accept an answer that's correct, but refreshing the page almost always fixes that for me.

Jonathon Mohon
Jonathon Mohon
3,165 Points

I had the exact same code as Katie and it tells me that its wrong. Says "you're not retrieving the movie 'title' first and the genre 'name' second. Use INNER JOIN."