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 trialDylan Van Es
11,085 PointsI'm sure I'm on the right track but I just can't get passed this step.
Here's my answer:
SELECT * FROM Media
JOIN Media_Genres ON Media.genre_id = Media_Genres.genre_id
LEFT OUTER JOIN Genres ON Media.genre_id = Genres.genre_id
WHERE Media.media_id = 3;
2 Answers
Steven Parker
231,271 PointsHere's a guess.
Instead of "Genres.genre_id
", perhaps it should be "Genres.Id
"?
If that's not it, please provide a link to the course you are working with and I can give a more accurate answer.
UPDATE — after seeing the instructions:
You have some issues with the joining criteria.
- the first join should be using the media_id fields instead of genre_id
- the second join should be
ON
the Media_Genres.genre_id, there is no "Media.genre_id" - while not an error, you don't need to make the second join an
OUTER
join
Dylan Van Es
11,085 PointsThat worked! Thanks heaps for your help!
Dylan Van Es
11,085 PointsThanks Steve,
Unfortunately "genre_id" is the name of the column needed. Here's the whole question:
We will be writing ONLY the SQL query for this challenge.
The library database contains a Media table with the columns media_id, title, img, format, year and category. It also contains a Genres table with the columns genre_id and genre. To join these tables, there is a Media_Genres table that contains the column media_id and genre_id.
Add to the following SELECT statement to JOIN the Media table and the Genres table using the joining table Media_Genres.
SELECT * FROM Media WHERE media_id=3;
NOTE: You will need to add the table to the WHERE clause so that the media_id column is not ambiguous.
The error I'm receiving is "You need to specify tables ON the JOIN." Unfortunately I have no idea what means :-(
Logan Fox
Courses Plus Student 3,379 PointsI have the same problem!
Dylan Van Es
11,085 PointsDylan Van Es
11,085 PointsSame as this issue: https://teamtreehouse.com/community/cannot-pass-this-php-task