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 Favorite Pharmacies

About

This report lists all pharmacies that are favorites of your patients.

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

Caveats

This SQL only includes preferences of patients with status = ‘ACTIVE’.

Code

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

select ra.patno, specialty_name, ab.fname, ab.lname, company from register_addendum ra
left outer join specialty on ra.specialty_id = specialty.specialty_id
left outer join addressbook ab on ra.addr_id = ab.addr_id
inner join register on ra.patno = register.patno 
 where specialty_name = 'PHARMACY' and status_pat ='ACTIVE'