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

Databases

What's the problem here? It keeps telling me to JOIN the tables, and I am JOINING the tables ..

select          *
from        media
join                media_genres on media_genres.media_id = media.media_id
join                genres on genres.genre_id = media_genres.genre_id
where       media.media_id = 3;

Here is the Quiz: https://teamtreehouse.com/library/integrating-php-with-databases/using-relational-tables/joining-tables

Also, why does it make you choose a topic when you're asking for help on a particular question? This shouldn't be an option. This whole ask a question, forum thing is quite poorly implemented. Please address this Treehouse.

Greg Kaleka
Greg Kaleka
39,021 Points

Can you point us to the challenge you're having trouble with?

For future reference, if you choose "Get Help" from the challenge menu, it will auto-select the right topic, and provide a way to get to the challenge automatically as well. Much easier to help if you go that way.

3 Answers

Steven Parker
Steven Parker
231,128 Points

You're right, I had also converted tabs to spaces. Here's the code that passed:

select *
from Media
join Media_Genres on Media_Genres.media_id = Media.media_id
join Genres on Genres.genre_id = Media_Genres.genre_id
where Media.media_id = 3;

Are you kidding me?! Brutal, lol. Thanks for your help. It actually had nothing to do with the casing, it was the tabs. That is definitely a bug.

Here's the code I used, same as yours, just to show it wasn't the casing.

select *
from media
join Media_Genres on Media_Genres.media_id = Media.media_id
join Genres on Genres.genre_id = Media_Genres.genre_id
where Media.media_id = 3;
Steven Parker
Steven Parker
231,128 Points

But that includes the case changes. I did try it with just the tabs converted and it did not pass.

There's something way crazier going on that I can't explain. I can't spend anymore time trying to figure out what's wrong.

When I use yours, I can change case like I posted, it passed.

When I used my original code above, and pasted, removed tabs, and even proper cased tables, it still wouldn't pass.

So it beats me.

Steven Parker
Steven Parker
231,128 Points

Perhaps we're overlooking a typo that gets fixed when you paste over the table names. But you still must also replace the tabs for it to pass. Might be worth a bug report.

No! I got yours to work with a tab! lol

Copy over your code, tab out Media, and it will pass! There's some weird things going on here. I tried copying both codes into a editor as well and look at them side by side, but I can't notice a difference. Only thing I can determine would be an issue, would be a hidden character, but I'm done with this, lol!

Steven Parker
Steven Parker
231,128 Points

Without a link to the challenge, I'm guessing; but here are some possibilities:

  • the challenge may want you to use "INNER JOIN" instead of just "JOIN"
  • the Media table might have an "id" field instead of "media_id"
  • the Genres table might have an "id" field instead of "genre_id"

And if you use the "Get Help" button to create a new question, the system will:

  • select the correct topic for you
  • provide a link to the course page via a button in the upper right
  • automatically include your code
  • format the code correctly using Markdown
  • provide a "breadcrumb trail" to make it easy to find similar questions

That last one cannot be done manually at all.

It's funny you both say this, but I did exactly what you told suggested. Used "Get Help" button to create a new question, and it didn't do any of the following but insert my code.

Here's the quiz, https://teamtreehouse.com/library/integrating-php-with-databases/using-relational-tables/joining-tables

Steven Parker
Steven Parker
231,128 Points

I tried it and got the same failure. But just on a whim, I replaced all the table names with ones I cut-and-pasted from the instructions ... and then it passed!

Perhaps the names are case-sensitive? But you may want to report this as a bug to Support. You may also want to report the "Get Help" button behavior as a bug.

You must have done more than that, because I just tried to do that and I had no luck. Could you post the SQL you used to pass the test? It keeps telling me to join on the table, but I'm joining on the table. The response to what I've done isn't very helpful, lol.