select tpc.objectrunstatus,b.executionId, a.applicationId,COUNT(IF(a.executionResult='pass',1,null)) as pass,COUNT(IF(a.executionResult='fail',1,null)) as fail from executionresult a inner join testexecution b on b.executionId=a.executionId
left join testprecheck tpc on tpc.executionId=b.executionId and tpc.appId=a.applicationId
where b.executionStatus='InProgress' group by a.executionId,a.applicationId