I'm working a course creation application, where the user needs to display all the students in X number of courses. For example, if a biology class is selected, the user should be able to filter users based on how many other courses they are already in. My table has the following fields: id, uid, courseid. I want to do something like but don't know what the syntax should be:
SELECT * FROM course_list WHERE count(uid) > X AND courseid=Z
Where X is the number of courses the user has filtered to (a value 0-3), and Z is simply the id of the course the user is currently looking at.