SELECT CONCAT(t.titlename,p.fname,' ',p.lname) AS
pname,h.hno,h.villcode,h.xgis,h.ygis,vd.sickdatestart,dc.group506name
FROM house AS h Inner Join person AS p ON h.pcucode = p.pcucodeperson
AND h.hcode = p.hcode Inner Join visit AS v ON p.pcucodeperson =
v.pcucodeperson AND p.pid = v.pid Inner Join visitdiag506address AS vd
ON v.pcucode = vd.pcucode AND v.visitno = vd.visitno Inner Join cdisease
AS d ON vd.diagcode = d.diseasecode Inner Join cdisease506 AS dc ON
d.code506 = dc.group506code Inner Join ctitle AS t ON p.prename =
t.titlecode WHERE dc.group506code = '02' AND vd.sickdatestart BETWEEN
'2002/10/29' AND '2011/10/29' AND SUBSTRING(h.villcode,7,2) <>
'00'
ORDER BY h.villcode,h.hno
ไม่มีความคิดเห็น:
แสดงความคิดเห็น