select user.realname name,
floor((sum(case  when  task.taskstatus ='20' then 1 else 0 end)/count(task.id))*100) rate
from p_projecttask task
left join t_s_base_user user on user.id = task.owner
where 1=1
<#if projectid ?exists && projectid ?length gt 0>
and task.projectid = :projectid
</#if>
<#if qrydate ?exists && qrydate ?length gt 0>
and left(task.planendtime,10) = :qrydate
</#if>
group by owner
