The query below brings back 50 records. If there are 10 clients in the database, I want it to bring back 500 records (the top 50 for each client). How do I modify this query to do that?
select top 50 count(), clients.id, clients.accountid, courses.Name
from courses
inner join clients on clients.id = courses.clientid
inner join courseenrollments on courses.id = CourseEnrollments.CourseId
where CourseEnrollments.DateCompleted between '2019-01-01' and '2020-01-01'
group by clients.id, clients.AccountId, courses.Name
order by count() desc, clients.Id