วันพฤหัสบดีที่ 30 มิถุนายน พ.ศ. 2559

รายชื่อกลุ่มเป้าหมายคัดกรองพัฒนาการเด็กปฐมวัยช่วงอายุ 9,18,30,และ 42 เดือน

  

*** แก้ไขช่วงวันที่ในแต่ละเดือนที่รัน code โดยกำหนดเป็น 'yyyy-mm-dd' ***


select
person.pid as pid,
concat(ctitle.titlename,person.fname,' ',person.lname)as pname,
person.birth as pbirth,
GetAgeymd(person.birth,'2015-12-01')as age,
person.idcard as idcard,
person.hnomoi as hno,
village.villno as villno,

case when GetAgemonth(person.birth,'2015-12-01')= '9' then "/" else '' end as '9เดือน',
case when GetAgemonth(person.birth,'2015-12-01')= '18' then "/" else '' end as '18เดือน',
case when GetAgemonth(person.birth,'2015-12-01')= '30' then "/" else '' end as '30เดือน',
case when GetAgemonth(person.birth,'2015-12-01')= '42' then "/" else '' end as '42เดือน'
from person inner join ctitle on person.prename = ctitle.titlecode
inner join house on person.pcucodeperson = house.pcucode and person.hcode = house.hcode
inner join village on house.pcucode = village.pcucode and village.villcode = house.villcode
where person.typelive in ('1','3') and person.pid not in (select persondeath.pid from persondeath)and substring(house.villcode,7,2)<>'00'
and GetAgemonth(person.birth,'2015-12-01') in ('9','18','30','42')
order by villno
Cr. Jhcis เมืองลำปาง

ไม่มีความคิดเห็น:

แสดงความคิดเห็น