SELECT c.cname, COUNT(e.ccode)
FROM class c
INNER JOIN enrolled e ON e.ccode = c.ccode
WHERE room = 'MB100'
AND e.ccode = < 10;
我正在努力找到MB100会议室中学生人数不足10人的课程名称,我哪里错了?
答案 0 :(得分:2)
您错过了group by c.cname
,试试这个:
SELECT c.cname, COUNT(e.ccode)
FROM class c
INNER JOIN enrolled e ON e.ccode = c.ccode
WHERE room = 'MB100'
Group by c.cname
Having e.ccode =< 10;