We are currently updating the OP Help Center content for the release of OP 19, which is a member of the certified OP 14 family of products. OP 19’s 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: Find Unattached Active Insurances

About

The SQL finds active insurance plans that are neither ranked as primary, secondary, or tertiary on the patient’s chart.

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

Caveats

  • This only looks at patients who have the patient status ACTIVE.
  • It only looks at non-self-pay insurance plans that are policies marked as ACTIVE.

Code

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

select patno, register.ins_carrier_code, register.insured_id, register.ins2_carrier_code, register.insured_id_other, register.ins_carrier_code_3,  register.insured_id_3, insured1.ins_carrier_code, insured1.insured_id from register
left outer join insured1 on insured1.patno = register.patno
where status_policy = 'ACTIVE' and status_pat = 'ACTIVE'
and register.lname <> 'TESTPATIENT'
and register.insured_id <> insured1.insured_id
and register.insured_id_other <> insured1.insured_id
and register.insured_id_3 <> insured1.insured_id
order by patno