SELECT cpersonincomplete.incompletename as 'ลักษณะความพิการ',
count(person.pid) as 'พิการ(คน)'
FROM
person INNER JOIN  personunable ON person.pcucodeperson = personunable.pcucodeperson
AND person.pid = personunable.pid
INNER JOIN personunable1type ON personunable.pcucodeperson = personunable1type.pcucodeperson
AND personunable.pid = personunable1type.pid

INNER JOIN cpersonincomplete ON personunable1type.typecode = cpersonincomplete.incompletecode
inner join house on person.hcode=house.hcode and person.pcucodeperson=house.pcucode
inner join village on house.villcode = village.villcode and house.pcucode = village.pcucode
AND person.pid = personunable.pid
where concat(person.pid,person.pcucodeperson)not in (select concat(persondeath.pid,persondeath.pcucodeperson)
from persondeath where deaddate<=curdate() or deaddate is not null) and SUBSTRING(house.villcode,7,2)<>'00'
and person.typelive in ('1','3')
group by incompletename;