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 trialDonnie Driskell
2,243 PointsReporting by example: 8th Grade Teachers. (my solution)
I might be wrong, but it seems that my particular query is shorter and returns values based on the teachers ID, F/L names and then grade at last column. I was wondering if this would work as an answer too ? thanks Donnie
SELECT DISTINCT ID, first_name, last_name, grade FROM teachers AS t JOIN (SELECT grade FROM students WHERE grade=8);
2 Answers
rafael mari
4,500 PointsUsing derived tables seems to work if you want a shorter query.
Select * from teachers where id in (select teacher_id from classes where subject_id in (select id from subjects where grade = 8))
Ashley Carpenter
13,393 PointsHi Donnie, I haven't tried it but that doesn't look it would be a valid query. You're missing some key parts like the 'on' part of your SQL join and a where clause to narrow the search just to 8th grade teachers. Go back to the challenge/video, open up the workspace and give it a bash.
kevin hudson
Courses Plus Student 11,987 Pointskevin hudson
Courses Plus Student 11,987 PointsI used this as well is this alright to do? Or should we use JOINING