We are currently updating the OP Help Center content for the release of OP 14.19 or OP 19. OP 19 is a member of the certified OP 14 family of products (official version is 14.19.1), which you may see in your software (such as in Help > About) and in the Help Center tabs labeled 14.19. You may also notice that the version number in content and videos may not match the version of your software, and some procedural content may not match the workflow in your software. We appreciate your patience and understanding as we make these enhancements.

SQL: Average Well Visit Payment by Ins Carrier (Without Vaccines)


This report lists the average payment for well visit by insurance carrier based on the date range you specify.

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


  • Insurance carrier is the PRIMARY insurance
  • "Well visit" is every CPT code that occurred for the same patient/DOS when a well code (9939x, 9938x) was used except for the vaccine and vaccine administration.
  • The date range you specify are DATES OF SERVICE, not payment dates.  
  • Enter dates old enough for the date range. If you pick recent dates of service (like yesterday), those claims won't be paid yet. Therefore, you would receive a bunch of zero payments averaged into the result.  
  • Payments include both the insurance side and patient side for ALL CPT codes (except the vaccines) associated with that visit.


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

select count(patno) as patients, ins_carrier_code, round(avg(paid),2) as avg_paid from

select patno, date1, ins_carrier_code, sum(total_pmt) as paid from

select b.patno, b.date1, b.cptcode, b.trnsxno, ins_carrier_code,  p+c as total_pmt from
select a.patno, a.date1, at2.cptcode, at2.trnsxno, ins_carrier_code from
select patno, date1, cptcode, ins_carrier_code from archive_transactions where cptcode in ('99391','99392','99393','99394','99395','99381','99382','99383','99384','99385') and date1 between :start_date and :end_date and archive_flag = 1
a left outer join
(select patno, date1, cptcode, trnsxno from archive_transactions where date1 between :start_date and :end_date and archive_flag = 1
and cptcode not in ('90460','90461','90471','90472','90473','90474')
and cptcode not between '90600' and '90799'
and cptcode not in ('1','2','3','4')
) at2 on a.patno = at2.patno and a.date1= at2.date1
b left outer join
(select txnopaid, sum(payment) as p, sum(copayrecd) as c from archive_transactions where date1 >= :start_date and txnopaid >0 group by txnopaid) at3 on at3.txnopaid = b.trnsxno
) group by patno, date1, ins_carrier_code
) group by ins_carrier_code