select staff,x.xn,x.hn,x.request_date,x.request_time,x.report_date,x.report_time,x.doctor,x.xray_type,
concat(p.pname," ",p.fname," ",p.lname) as ptname , d.name as doctor_name ,
d2.name as request_doctor_name , t.name as xray_type_name ,x.vn,x.an ,v.age_y,
xi.* , rx.xn as real_xn
,xf.film_name as "ขนาด Film ที่ใช้",xrf.qty as "จำนวน Film ที่ใช้",xd.damage_name as "สาเหตุ กรณี Film เสีย"from xray_report x
left outer join patient p on p.hn=x.hn
left outer join doctor d on d.code=x.doctor
left outer join doctor d2 on d2.code=x.request_doctor
left outer join xray_type t on t.xray_type = x.xray_type
left outer join xray_items xi on xi.xray_items_code=x.xray_items_code
left outer join vn_stat v on v.vn=x.vn
left outer join xray_report_film xrf on xrf.xn = x.xn
left outer join xray_film xf on xf.film_id = xrf.film_id
left outer join xray_damage xd on xd.damage_id = xrf.damage_idleft outer join xrayxn rx on rx.hn=x.hn
and rx.regdate between "2008-01-11" and "2008-01-11"
where ( x.request_date between "2008-01-11" and "2008-01-11")
and x.xray_items_code not in (0)
and (x.confirm="Y")
... น่าจะพอใช้ได้นะครับ ...
...