SELECT person.pid,prename,fname,lname,birth,idcard,hnomoi,mumoi,typelive,rightcode,rightno,hosmain,hossub
FROM person
LEFT JOIN persondeath ON person.pcucodeperson = persondeath.pcucodeperson AND person.pid = persondeath.pid
WHERE persondeath.pid IS NULL
and mumoi<> '00' and person.typelive in (1,3)
and person.hossub <> person.pcucodeperson
GROUP BY person.pid;