Skip to content
Partner Developer Portal

Definition

The Dbo Organisationidentifier model holds national codes and messaging-recipient identifiers recorded for organisations. Each record includes an organisation identifier, NACS and national codes, and MHS2 and EPMS message-recipient identifiers, together with the organisation information associated with that entry.

_deleted indicates whether the record has been deleted in the source system.

dbo.organisationidentifier with dbo.organisation details

Section titled “dbo.organisationidentifier with dbo.organisation details”

Return records alongside descriptive values from the related dbo.organisation record.

SELECT
m."_primary_key",
m."organisationid",
p1."organisationdisplayname" AS "organisationdisplayname"
FROM dbo.organisationidentifier AS m
LEFT JOIN dbo.organisation AS p1
ON p1."organisationid" = m."organisationid"
AND p1."organisation" = m."organisation";

Row count by dbo.organisation organisationdisplayname

Section titled “Row count by dbo.organisation organisationdisplayname”

Count dbo.organisationidentifier records for each dbo.organisation value, joined on organisationid.

SELECT
p."organisationdisplayname" AS "organisationdisplayname",
COUNT(*) AS row_count
FROM dbo.organisationidentifier AS m
INNER JOIN dbo.organisation AS p
ON p."organisationid" = m."organisationid"
AND p."organisation" = m."organisation"
GROUP BY p."organisationdisplayname"
ORDER BY row_count DESC;

Records without a matching dbo.organisation

Section titled “Records without a matching dbo.organisation”

Find dbo.organisationidentifier records whose organisationid has no matching dbo.organisation record.

SELECT
COUNT(*) AS unmatched_count
FROM dbo.organisationidentifier AS m
LEFT JOIN dbo.organisation AS p
ON p."organisationid" = m."organisationid"
AND p."organisation" = m."organisation"
WHERE m."organisationid" IS NOT NULL
AND p."organisationid" IS NULL;