คำสั่งที่ผมทดลองเป็นยังนี้ ครับ
Select v.vn,v.hn, concat(p.pname,p.fname,' ',p.lname) as patient_name, v.vstdate, v. accident_code,
p.cid, v.age_m,
v.age_y, v.aid,
pt.name as patient_pttype_name,
pn.pttypeno,
s.vsttime,
s.temperature,
i.name as pdx_name,
v.pdx,
c.name as occupation_name,
s.pulse,
s.rr,
s.bps,
s.bpd,
s.height,
s.bw,
p.drugallergy,
concat(hhh.hosptype,hhh.name) as hostname,
sdi.name as drug_name,
ds.shortlist,
oi.qty as qty_name,
oi.sum_price as item_price,
dt.name as doctor_name,
v.item_money as item_money
from vn_stat v
left outer join ovst o on o.vn=v.vn
left outer join patient p on p.hn = v.hn
left outer join opdscreen s on s.vn=v.vn
left outer join occupation c on c.occupation = p.occupation
left outer join icd101 i on i.code = v.main_pdx
left outer join referout r on r.vn = o.vn
left outer join hospcode hhh on hhh.hospcode = r.hospcode
left outer join pttypeno pn on pn.hn=v.hn
left outer join opitemrece oi on oi.vn=v.vn
left outer join drugitems di on di.icode=oi.icode
left outer join drugusage ds on ds.drugusage=oi. Drugusage
left outer join doctor dt on dt.code=oi.doctor
left outer join pttype pt on pt.pttype=v.pttype
left outer join s_drugitems sdi on sdi.icode=oi.icode
where
v.vn='510720153455'
and v.pttype ='34' and
v.vstdate between '2008-07-01' and '2008-07-31'
order by oi.item_no
ตรง ตัวอักษร สีแดงนี้ ไม่ แน่ใจว่ากูกหรือเปล่า