I'm trying to Select a Record that has the Maximum Count of a character e.g 'A' and get this error "Cannot perform an aggregate function on an expression containing an aggregate or a subquery.". What is causing this, and how can I correct it.Thanks!
select
*
from GROUPS as G
inner join STUDENT_GROUP as SG
on sg.Group_ID = g.Groups_ID
inner join STUDENT as S
on s.Student_ID = sg.Student_ID
inner join STUDENT_MARKS as SM
on SM.Student_ID=s.Student_ID
inner join smark as m
on m.mark_id=sm.Mark_ID
where m.Mark_name = max(count('A'));