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

PHP

mohamad hossein Damad
mohamad hossein Damad
4,430 Points

what is this question exactly wants with me? how can i add to the select statement? :D

i cant understand the first question in this assessment.

Can you provide a link to the quiz/challenge/source material you have a question about? That way I can better understand how to help you.

mohamad hossein Damad
mohamad hossein Damad
4,430 Points

this is my way to do it but i think i didnt understand the question in first glance.

select * from Media as m inner join Media_Genres as mg on m.media_id = mg.media_id inner join Genres as g on g.genre_id = mg.genre_id where m.media_id=3;

1 Answer

Your answer looks an awful lot like what I got to pass a while back with the exception of yours being an inner join. I had to strip out table aliasing and use their full names throughout the query to get it to pass. I've put my code below as well as yours with stripped aliases so you can copy it to see if it passes (right now when I check work it hangs and then throws an error).

Yours:

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

Mine:

SELECT *
FROM Media
JOIN Media_Genres
    ON Media_Genres.media_id = Media.media_id
JOIN Genres
    ON Media_Genres.genre_id = Genres.genre_id
WHERE Media.media_id = 3;

Edit: Checked again now that my internet is stable and it appears to pass. So the only issue with your code was table aliasing which isn't really an issue but more of a limitation of Treehouse.

mohamad hossein Damad
mohamad hossein Damad
4,430 Points

you are so kind and thanks alot for your help. have a good time and thanks.

You're very welcome!