ok, so the request I would like to resolve is:
I would like to express the following business rule:
Display groups (for a particular tutorial (tutorialID) and week (s)) requiring additional reviews.
So, basically I need to determine the number of members in the group, then I need to collect all the hits for this week and this group and see if this amount is equal to the number of members in the group. If so, it means that all participants were viewed this week, and therefore they do not need to be displayed.
Assumptions: A member can only be viewed once a week.
I tried the following SQL, however I get the following error Subquery returns more than 1 row
SELECT groupName, g.groupId
FROM `student` s, `group` g
WHERE s.GroupId = g.GroupId
AND s.GroupId IS NOT NULL
AND s.tutorialId = 2
GROUP by s.GroupId
AND s.GroupID = (
SELECT GroupId
FROM student
GROUP BY GroupId
HAVING count(*)> (
SELECT count(*)
FROM scrumreview r, student s
WHERE r.reviewee = s.studentID
GROUP BY GroupId
AND r.week = 5
)
)
Student

scrumreview

groups

source
share