SQL: Simple Schedule Review

There are two versions of this SQL: Firebird and MySQL. The MySQL version only applies to clients who are have migrated to MySQL.. All other Practices should continue to use the Firebird version of this code. Click to expand and copy the code you need. If you are unsure which code to use, please check with your Practice Administrator.

About

This report shows location, scheduled provider, appt date & time, patient name, chart number, DOB, appt type, primary phone number, visit status for the date range that you specify.

A sample image of this SQL report run in the Database Viewer is shown below:

Caveats

A blank visit status indicates a future scheduled appointment.

SQL Code: Firebird

To highlight and copy the code below to your clipboard, simply click the Copy button.

select loc_name, staffname as scheduled_provider, dateadd(minute,start_time,appt_date) as my_appt_time, ( fname || ' ' || lname) as patient_name, patno, birthdat, code1 as appt_type, hphone, visit_status from schedule
inner join register on register.patno = schedule.patno
inner join staff1 on staff1.staffid = schedule.addr_id
inner join location on location.id = schedule.loc_id
 where appt_date between :Start_date and :end_Date
order by appt_date,2


SQL Code: MySQL

To highlight and copy the code below to your clipboard, simply click the Copy button.

select loc_name, staffname as scheduled_provider, date_add(appt_date, interval start_time minute) as my_appt_time, ( fname || ' ' || lname) as patient_name, schedule.patno, birthdat, code1 as appt_type, hphone, visit_status from schedule
inner join register on register.patno = schedule.patno
inner join staff1 on staff1.staffid = schedule.addr_id
inner join location on location.id = schedule.loc_id
 where appt_date between :start_date and :end_date
order by appt_date,2