ผมเขี่ยนแบบนี้อ่ะครับ
select concat(p.pname,p.fname," ",p.lname) as ptname, p.hn, o.rxdate, v.age_y, concat(d.name,d.strength,d.units) as drugname,
opn.ovst_presc_ned_id as id,dl.doctor_reason as wat,
dl1.doctor_reason as re1,dl2.doctor_reason as re2,dl3.doctor_reason as re3,dl4.doctor_reason as re4,dl5.doctor_reason as re5,
opn.*, concat(i.code,i.name,"(",i.tname,")") as diag, o.qty,
o.sum_price, ocd.doctor as control_doctor,v.vstdate,
if(ocd.doctor is null,opn.doctor,ocd.doctor) as doctor_order ,dc.name as wat
from ovst_presc_ned opn
join drugitems d on d.icode = opn.icode
join drugitems_ned_reason_list dl1 on opn.presc_reason = dl1.claim_control
join drugitems_ned_reason_list dl2 on opn.presc_reason_2 = dl2.claim_control
join drugitems_ned_reason_list dl3 on opn.presc_reason_3 = dl3.claim_control
join drugitems_ned_reason_list dl4 on opn.presc_reason_4 = dl4.claim_control
join drugitems_ned_reason_list dl5 on opn.presc_reason_5 = dl5.claim_control
join opitemrece o on o.vn = opn.vn and o.icode = opn.icode
join patient p on p.hn = o.hn
join vn_stat v on v.vn = o.vn
left outer join icd101 i on i.code = v.pdx
left outer join ovst_control_doctor ocd on ocd.vn=opn.vn
left outer join drugitems_ned_reason_list dl on opn.presc_reason = dl.claim_control
left outer join doctor dc on opn.doctor = dc.code
where opn.vn = "550709072943" and opn.doctor = "0115"
แต่กดพิมพ์แล้ว มันไม่พิมพ์ อ่ะครับ ท่าน