table name: tbl_schedule
tr_id(P.K.) mr_id(F.K.) sch_date doctor_id
----------- ----------- -------- ----------
1 23 01/01/2012
First of all u make sure that you have defined
sch_date
as DATE type AND Database engine should be InnoDb
then it is easy to fetch data as per your question
SELECT T2.mr_id,T2.mr_fname,T2.mr_lname,COUNT(doctor_id) FROM tbl_schedule AS T1 INNER JOIN tbl_user AS T2 ON T1.mr_id = T2.mr_id WHERE T1.sch_date > 'date1' AND T1.sch_date < 'date2' GROUP BY doctor_id HAVING COUNT(doctor_id) > 0