select t1.id,t1.name,CONCAT(t1.begin,' ~ ',t1.end) as timeLimit,t2.teams,t3.stories,round(t4.consumed,1) as consumed,t4.number,if($status='','',t1.status) as projectstatus from TABLE_PROJECT as t1 left join ztv_projectteams as t2 on t1.id=t2.project left join ztv_projectstories as t3 on t1.id=t3.project left join ztv_projectsummary as t4 on t1.id=t4.project where t1.deleted='0' and if($beginDate='',1,t1.begin>=$beginDate) and if($endDate='',1,t1.end<=$endDate) having projectstatus=$status