SQL: CPT Frequency of Dates

About

Shows CPT codes with frequency for a given time period.

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


Caveats

The report gives both the frequency and total units for each CPT code.   Frequency is the number of times it was billed during the period; total units is the total number of units billed during the period.  These numbers will be the same for CPTs that can only be billed once per day per patient (e.g. 99213); however, codes which are often billed in multiple units (e.g. 90461) will have a much higher “total units” count than “frequency” count.

SQL Code: Firebird

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

select cptcode, count(cptcode) as frequency, sum(units) as total_units from (
select patno, date1, cptcode, units from archive_transactions where date1 between :Start_date and :end_date and txnopaid = 0 and archive_Flag = 1) 
group by cptcode
order by total_units desc 

SQL Code: MySQL

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

select cptcode, count(cptcode) as frequency, sum(units) as total_units from (
select patno, date1, cptcode, units from archive_transactions where date1 between :Start_date and :end_date and txnopaid = 0 and archive_Flag = 1) a
group by cptcode
order by total_units desc