We are currently updating the OP Help Center content for the release of OP 14.19 or OP 19. OP 19 is a member of the certified OP 14 family of products (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 Contact by First Name and Last Name

About

This sql performs a search of all Contacts in your system for the first name and last name you specify. It then lists the patient chart(s) where that individual is associated.

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

Caveats

  • The search conditions must be an exact match. For example, searching for Mary Ann Smith will not show MaryAnn Smith, or searching for Aria Martinez will not show Aria Martinez-Garcia.  To see all Contacts so you can add adjustable filters for fuzzy searching, see Contacts and Associated Patient Charts.
  • The Contact may have any relationship to the patient chart.

Code

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

select first_name as contact_first, last_name as contact_last,  patno, fname as patient_first, lname as patient_last from  register
inner join register_contact on register.patno = register_contact.patno
inner join contact on contact.id = register_contact.contact_id
where patno is not null and patno >= 99
and first_name = upper(:contact_first_name_to_look_for) and last_name = upper(:contact_last_name_to_look_for)
order by patno