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

JavaScript

Is there an error in the calculation?

So I formulated my query slightly differently and came to notice that the result is 45. I checked the data and noticed that there are two duplicates if we formulate the request in the same way as in the video. Here my solution:

''' SQL SELECT COUNT(DISTINCT(STUDENTS.FIRST_NAME)) FROM STUDENTS JOIN SCHEDULE ON SCHEDULE.STUDENT_ID = STUDENTS.ID JOIN CLASSES ON SCHEDULE.CLASS_ID = CLASSES.ID JOIN SUBJECTS ON CLASSES.SUBJECT_ID = SUBJECTS.ID WHERE SUBJECTS.NAME = "Physical Education" AND PERIOD_ID = 1 ORDER BY STUDENTS.FIRST_NAME; '''

What challenge or exercise does this go with?