2
« เมื่อ: มีนาคม 02, 2011, 14:37:06 PM »
select x.*,concat(p.pname,p.fname,' ',p.lname) as ptname ,r.xn as real_xn,i.xray_items_name,
v.age_y ,pr.main_regiment ,pr.sub_regiment,d.name as doctor_request,xs.name as xs_name,xt.name as xt_name
from xray_report x
left outer join xray_items i on i.xray_items_code=x.xray_items_code
left outer join xray_side xs on x.xray_side=xs.xray_side
left outer join xray_type xt on x.xray_type=xt.xray_type
left outer join vn_stat v on v.vn=x.vn
left outer join an_stat a on v.vn=a.vn
left outer join ward w on a.ward=w.ward
left outer join xray_head xh on v.vn=xh.vn
left outer join doctor d on x.doctor=d.code
left outer join patient p on p.hn=x.hn
left outer join patient_regiment pr on p.hn=pr.hn
left outer join xrayxn r on r.hn=x.hn
where x.xn = '232' and r.regdate between '2006-03-01' and '2006-08-15'