Ahoi everyone
I'm really new to SQL and have some homework for Uni to do.
I have got the following two tables:
Professors with:
ID, Name
and Assistans with:
ID, Name, Boss (foreign key)
My task is to find the professor with the most assistants.
What I have so far:
select top 1
p.name,
count (a.name) as NumberOfAssistants
from
Professors p, Assistants a
where
a.Boss = p.ID
group by
name
order by
NumberOfAssistants
My problem is, that there are two professors with the same and maximum amount of Assistants. So Top 1doesn't work for me.
I'm kinda desperate as I cant wrap my head around this. Hope you can help me.
Thanks in advance