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!
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
Artan Muzhaqi7,983 Points
The code doesn't work. Unable to retrieve results SQLSTATE[HY000]: General error: 1 ambiguous column name: media_id
i copied everything from the video but on mine it doesn't work.
Alex Hughes4,728 Points
You're right - in the video, the query written is incorrect. From what I understand, she's joining on "media_id" in the video, when it should be joining on "genre_id".
Try this SELECT statement and it should work!
"SELECT title, category, img, format, year, publisher, isbn, genre FROM Media JOIN Genres ON Media.genre_id=Genres.genre_id LEFT OUTER JOIN Books ON Media.media_id = Books.media_id WHERE Media.media_id = $id"
Hope that works for you!
Thanks a lot for your answer. This had me stumped for a bit. The course video should be recorded.
This was perfect, Thank you!!