select min(vn),doctor_date,doctor_time,doctor from pq_doctor p
inner join doctor d on d.code=p.doctor and d.position_id="1"
where doctor_date between"2013-10-01" and "2014-08-31" and doctor_time between"08:00" and "16:00"
group by doctor_date,doctor
order by doctor_date ,doctor