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 trialTocker Ackermann
15,955 PointsCan someone help me figure out how to add another condition to a WHERE clause?
Here is the task: "The Media
table also contains a category
column. Add another condition to the WHERE clause so that only the "Books" category is selected."
I've already written this code for the previous task:
SELECT title FROM Media
JOIN Media_People ON Media.media_id = Media_People.media_id
JOIN People ON Media_People.people_id = People.people_id
WHERE fullname LIKE '%Tolkien';
Now I've written:
SELECT title, category FROM Media
JOIN Media_People ON Media.media_id = Media_People.media_id
JOIN People ON Media_People.people_id = People.people_id
WHERE fullname LIKE '%Tolkien' & category = "Books";
I'm not sure why I keep getting the error "Did you select ONLY the 'title' from the 'Media' table?"
Can someone please help?
1 Answer
Tocker Ackermann
15,955 PointsSELECT title FROM Media
JOIN Media_People ON Media.media_id = Media_People.media_id
JOIN People ON Media_People.people_id = People.people_id
WHERE fullname LIKE '%Tolkien' AND category = "Books";
JEFFERSON DCRUZ
Courses Plus Student 7,772 PointsJEFFERSON DCRUZ
Courses Plus Student 7,772 PointsThanks mate. Thats one I was looking for