หัวข้อเดิมเข้าไม่ได้ครับ
Value :=GetSQLintegerData('select count(p.person_id) from person p,house h,village v,person_epi p1,person_epi_nutrition p2'+
' where p.house_id=h.house_id'+
' and h.village_id = v.village_id'+
' and p2.nutrition_date between "'+ds1+'" and "'+ds2+'"'+
' and p1.person_epi_id = p2.person_epi_id '+
' and p.person_id=p1.person_id'+
' and p2.nutrition_level in ("1","2","3","4","5")'+
' and p.age_y<="5"'+
' and p.age_m<="11"'+
' and p.age_d<="30"'+
' and p.age_y is not null'+
' and v.village_id not in ("0")'+
' and p.house_regist_type_id = "1" and "3"' +
'union '+
' select count(p.person_id) from person p,house h,village v,person_wbc p3,person_wbc_service p4'+
' where p.house_id=h.house_id and h.village_id = v.village_id'+
' and p3.person_wbc_id=p4.person_wbc_id'+
' and p4.service_date between "'+ds1+'" and "'+ds2+'"'+
' and p.person_id=p3.person_id'+
' and p4.nutrition_level in ("1","2","3","4","5")'+
' and p.age_y<="5"'+
' and p.age_m<="11"'+
' and p.age_d<="30"'+
' and p.age_y is not null'+
' and p.house_regist_type_id in ("1","3")' +
' and v.village_id = "'+DBPipeline['village_id']+'" ');