หรือจะลองประมาณนี้
select o.vn,o.hn,o.an,o.vstdate,o.vsttime,o.main_dep
,er.enter_er_time,er.doctor_tx_time,er.finish_time,er.er_list
from er_regist er
left join ovst o on o.vn=er.vn
where er.vstdate between '2011-06-01' and '2011-06-31'
and o.main_dep<>005