select a.vstdate,a.hn,concat(c.pname,c.fname,' ',c.lname) as ptname,service12,service3,sec_to_time(time_to_sec(service12)-time_to_sec(service3)) as totaltime
from service_time a
inner join er_regist b on b.vn=a.vn
left outer join patient c on c.hn=a.hn
where a.vstdate between'2006-04-30'and'2006-04-30'
order by a.vstdate,a.vn asc