SQL: Pending Referrals on non-Active Patients

About

This report looks at all patients who have open (PENDING) referrals but do not have an ACTIVE patient status within the practice.

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

Caveats

None.

Code

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

select register.patno, status_pat, status_date, refmd from register
inner join referalletter r1 on r1.patno = register.patno
where status_pat <> 'ACTIVE' and custom1 = 'REFERRAL' and status = 'PENDING'
order by patno