select
	 dep.glcname as name
	,count(*) as noFinishTaskTotal

from
	ACT_HI_TASKINST hi
	inner join t_s_base_user bu on hi.ASSIGNEE_=bu.username
	inner join t_s_user_org org on org.user_id=bu.ID and ifpluralism='0' and org.status='0'
	inner join t_s_depart dep on org.org_id=dep.ID
where hi.END_TIME_ is null
group by dep.id
order by noFinishTaskTotal desc
limit :rows