显示作为 activity 主管职责最多的户外教练的姓名

Display the name of the outdoor instructor who has the most duties as an activity supervisor

架构是:
ACTIVITY_SUPERVISOR(主管 ID)
OUTDOOR_INSTRUCTOR(InstructorID、InstrName、InstrPhone、SupervisorID)

这是我写的,但它不起作用

 SELECT O.InstructorID, O.InstrName, O.SupervisorID, A.SupervisorID, COUNT(*) 
 FROM Outdoor_instructor O, Activity_supervisor A 
 INNER JOIN Activity_supervisor A ON A.SupervisorID = O.SupervisorID 
 GROUP BY SupervisorID O, InstrName O 
 ORDER BY COUNT(*) DESC 
 LIMIT 1; 

您的查询中有两个对 "Activity_supervisor A" 的引用。 您的分组中也应该有更多的值

试试这个:

 SELECT O.InstructorID, O.InstrName, O.SupervisorID, A.SupervisorID, COUNT(*) 
 FROM Outdoor_instructor O
 INNER JOIN Activity_supervisor A ON A.SupervisorID = O.SupervisorID 
 WHERE rownum = 1
 GROUP BY O.InstructorID, O.InstrName, O.SupervisorID, A.SupervisorID 
 ORDER BY COUNT(*) DESC