แก้ไขให้แล้วครับ ตามรูปเลยครับ
แก้ไข sql เพิ่มเติม
select o.hn,p.pname,p.fname,p.lname,vs.age_y,k.department,p.moopart,p.tmbpart,op.bpd,op.bps,s.*,spclty.name as spclty_name,
sec_to_time(time_to_sec(s.service6)-time_to_sec(o.vsttime)) as totaltime1
from ovst o
left outer join patient p on p.hn = o.hn
left outer join opdscreen op on op.vn = o.vn
left outer join vn_stat vs on vs.vn = o.vn
left outer join service_time s on s.vn =o.vn
left outer join kskdepartment k on k.depcode = o.cur_dep
left outer join spclty on spclty.spclty = o.spclty
where o.vstdate between '2008-02-05' and '2008-02-10'
and spclty.spclty="01" and s.service6 is not null