1
แจ้งปัญหา / ขอความช่วยเหลือ / Re: มือใหม่ครับ ขอให้ช่วยตรวจสอบ code ว่าถูกต้องไหมครับ
« เมื่อ: ตุลาคม 30, 2016, 22:22:34 PM »
หรือแบบนี้ครับ
SELECT ovst.hn, concat(patient.pname,patient.fname," ",patient.lname) AS FULLNAME,
lab_items.lab_items_name, lab_order.confirm,vn_stat.pcode,vn_stat.pdx,c.clinic, ovst.vstdate,
patient.informaddr
FROM ovst ovst
inner join clinicmember c on c.hn=ovst.hn
inner JOIN vn_stat ON ovst.vn = vn_stat.vn
INNER JOIN patient ON (vn_stat.hn = patient.hn)
INNER JOIN lab_head ON lab_head.vn = vn_stat.vn
INNER JOIN lab_order ON (lab_order.lab_order_number = lab_head.lab_order_number)
INNER JOIN lab_items ON lab_items.lab_items_code = lab_order.lab_items_code
INNER JOIN thaiaddress a on (a.chwpart=patient.chwpart and a.amppart=patient.amppart and a.tmbpart=patient.tmbpart)
WHERE lab_order.lab_items_code = '294' AND ovst.vstdate BETWEEN '2015-10-01' AND
'2016-09-30' AND ovst.vn = vn_stat.vn and c.clinic="001" and vn_stat.pcode ='UC'
and lab_order.confirm ="Y"
group by ovst.hn
ORDER BY ovst.vstdate
SELECT ovst.hn, concat(patient.pname,patient.fname," ",patient.lname) AS FULLNAME,
lab_items.lab_items_name, lab_order.confirm,vn_stat.pcode,vn_stat.pdx,c.clinic, ovst.vstdate,
patient.informaddr
FROM ovst ovst
inner join clinicmember c on c.hn=ovst.hn
inner JOIN vn_stat ON ovst.vn = vn_stat.vn
INNER JOIN patient ON (vn_stat.hn = patient.hn)
INNER JOIN lab_head ON lab_head.vn = vn_stat.vn
INNER JOIN lab_order ON (lab_order.lab_order_number = lab_head.lab_order_number)
INNER JOIN lab_items ON lab_items.lab_items_code = lab_order.lab_items_code
INNER JOIN thaiaddress a on (a.chwpart=patient.chwpart and a.amppart=patient.amppart and a.tmbpart=patient.tmbpart)
WHERE lab_order.lab_items_code = '294' AND ovst.vstdate BETWEEN '2015-10-01' AND
'2016-09-30' AND ovst.vn = vn_stat.vn and c.clinic="001" and vn_stat.pcode ='UC'
and lab_order.confirm ="Y"
group by ovst.hn
ORDER BY ovst.vstdate