SQL: Total Adjusted by Adjustment Code

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 looks at all adjustments for a period and totals them by adjustment code.

Note: The ADJ CODE (Adjustment Code) column displays the internal OP Code that is converted from the EOB to an OP archived_transaction.

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

Caveats

  • This does not include voided transactions.
  • This includes both insurance-side and patient-side adjustments.

SQL Code: Firebird

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

select a.*, descript from
(
select adj_code, sum(tot_a) as total_adj from

(
select trnsxno, patno, date1, cptcode, adj_code, adjustment + copayadjustment as tot_a from archive_transactions where adj_code >0 and date1 between :startdate and :enddate and archive_flag = 1
order by adj_code
) 

group by adj_code
) a
left outer join
(select code_id, descript from code_table where group_id =1) c on c.code_id = a.adj_code


SQL Code: MySQL

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

select a.*, descript from
(
select adj_code, sum(tot_a) as total_adj from

(
select trnsxno, patno, date1, cptcode, adj_code, adjustment + copayadjustment as tot_a from archive_transactions where adj_code >0 and date1 between :start_date and :end_date and archive_flag = 1
order by adj_code
) t1

group by adj_code
) a
left outer join
(select code_id, descript from code_table where group_id =1) c on c.code_id = a.adj_code