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 trial

Databases SQL Reporting by Example Day 3: Getting Good at Grouping Most Popular Teacher

Most Popular Teacher4:28

Hi, I seemed to get the same answer to the solution worked question, but my query was different:

'''WITH ELEC_TEACHERS AS''' ( '''SELECT first_name, last_name, name, count(student_id) AS 'CT' FROM TEACHERS''' '''JOIN CLASSES ON teachers.id = classes.teacher_id''' '''JOIN SCHEDULE ON schedule.class_id = classes.id''' '''JOIN SUBJECTS ON subjects.id = classes.subject_id''' '''WHERE GRADE IS NULL''' '''GROUP BY teacher_id''' '''ORDER BY COUNT(student_id) DESC''' ) ''' SELECT first_name, last_name, MAX(CT) FROM ELEC_TEACHERS;'''

IS this okay?

https://teamtreehouse.com/library/most-popular-teacher

It's okay guys I have re-watched the video and it makes sense. You can just ignore this.

Thanks Mike

Patrik Horváth
Patrik Horváth
11,110 Points

can you edit it ? and post it in CODE because i m totaly LOST :(

Steven Parker
Steven Parker
231,275 Points

As Patrik said ... and also please provide a link to the course page you are working with.