select
date_format(dchdate,'%Y-%m') as calcmonth,
sum(IF(datediff(dchdate,regdate)=0,1,datediff(dchdate,regdate))) as los,
DAY(LAST_DAY(dchdate)) as ccc,
((sum(IF(datediff(dchdate,regdate)=0,1,datediff(dchdate,regdate))))*100/60/DAY(LAST_DAY(dchdate))) as bedratio
from ipt
group by calcmonth
ไม่มีความคิดเห็น:
แสดงความคิดเห็น