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.

Luke McGuigan
14,228 PointsTrouble with challenge 2 of Multiple Conditionals (Integrating PHP with Databases)
Hello, the following is the SQL query I've used for this task, whilst it's pulling only the title from the media title in regards to the lastname of 'Tolkien', it seems the issue where this isn't being accepted if that duplicates of each item are being produced.
SELECT title FROM Media me JOIN Media_People m, People p ON m.people_id = p.people_id WHERE fullname LIKE '%Tolkien';
I was wondering if anyone could provide assistance on this.
Thanks

Luke McGuigan
14,228 Pointscertainly, here's the link for this particular challenge: https://teamtreehouse.com/library/integrating-php-with-databases/filtering-input-for-queries/multiple-conditionals
3 Answers

Simon Coates
28,693 PointsSELECT m.title FROM Media m
JOIN Media_People mp ON m.media_id = mp.media_id
JOIN People p ON mp.people_id = p.people_id
WHERE p.fullname like '%Tolkien';

Luke McGuigan
14,228 PointsThank you for your assistance, that worked wonderfully, I need to reconsider how I write SQL queries.

Cindy Lea
Courses Plus Student 6,485 PointsIs me in front of the JOIN supposed to be there?

Luke McGuigan
14,228 PointsIt's just an alias to reference the Media table, though it may be redundant here, regardless I received the same result without it.

Justin Thomas
10,461 PointsDoes anybody know the answer to task 3 of this same challenge? Really struggling on that one

Simon Coates
28,693 PointsGiven the URL provided, the third part looks something like:
SELECT m.title FROM Media m
JOIN Media_People mp ON m.media_id = mp.media_id
JOIN People p ON mp.people_id = p.people_id
WHERE p.fullname like '%Tolkien' and m.category = "Books"
Simon Coates
28,693 PointsSimon Coates
28,693 Pointscan you add a link to the challenge this is in reference to?