Important Content Update Message
We are currently updating the OP Help Center content for OP 20. We appreciate your patience as we continue to make these updates. To locate the version of your software, navigate to: Help tab > About.

SQL: Invalid Appointment Types on Scheduled Appointments


This SQL identifies Appointment Types on scheduled appointments that do not match an Appointment Type in your system.


  • If the SQL returns no results, then there is no action necessary. 
  • If results are returned, the appointment needs to be edited so that it includes a valid Appointment Type.


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

select s.appt_date as appointment_date, s.create_datetime as appointment_scheduled_on, s.patno as patient_id, s.code1 as appt_reason from schedule s where s.appt_date > current_timestamp and s.patno > 0 and s.code1  not in (select code1 from appt_type where code_type = 0) order by s.appt_date