Definition
Information
Section titled “Information”The Professionalcontact Contact model holds identifying details for professional contacts, including their title, forename and surname. It records contact identifiers, an active flag, organisation and user-role identifiers, and a user-identifier type and value, together with the recorded organisation information.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”professionalcontact.contact with dbo.organisation, dbo.useridentifiertype and dbo.userinrole details
Section titled “professionalcontact.contact with dbo.organisation, dbo.useridentifiertype and dbo.userinrole details”Return records alongside descriptive values from the related tables.
SELECT m."contactid", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname", m."useridentifiertypeid", p2."description" AS "useridentifiertype_description", m."userinroleid", p3."contractualrelationship" AS "userinrole_contractualrelationship"FROM professionalcontact.contact AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.useridentifiertype AS p2 ON p2."useridentifiertypeid" = m."useridentifiertypeid" AND p2."organisation" = m."organisation"LEFT JOIN dbo.userinrole AS p3 ON p3."userinroleid" = m."userinroleid" AND p3."organisation" = m."organisation";professionalcontact.patientprofessionalcontact count per professionalcontact.contact
Section titled “professionalcontact.patientprofessionalcontact count per professionalcontact.contact”Count related professionalcontact.patientprofessionalcontact records for each professionalcontact.contact record, joined on contactid.
SELECT m."contactid", m."title", COUNT(c."contactid") AS patientprofessionalcontact_countFROM professionalcontact.contact AS mLEFT JOIN professionalcontact.patientprofessionalcontact AS c ON m."contactid" = c."contactid" AND m."organisation" = c."organisation"GROUP BY m."contactid", m."title"ORDER BY patientprofessionalcontact_count DESC;Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count professionalcontact.contact records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM professionalcontact.contact AS mINNER JOIN dbo.organisation AS p ON p."organisationid" = m."organisationid" AND p."organisation" = m."organisation"GROUP BY p."organisationdisplayname"ORDER BY row_count DESC;