select 
	dept.glcname AS name,
	count(*) as noFinishTaskTotal
from p_projecttask task
left join t_s_depart dept on dept.id = task.projectid 
where  (task.taskstatus ='0' or task.taskstatus ='1')
and task.tasktype<>'weeklyschedule'
and task.projectid is not null
group by task.projectid 
order by noFinishTaskTotal desc
limit :rows