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:
- 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.
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