Definition
Information
Section titled “Information”The Patientadminconfig States model holds patient-administration state definitions and their display text. Each entry records a state GUID, state-type identifier and organisation-configuration identifier, alongside an obsolete flag, an organisation identifier and the organisation information recorded for that state.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”patientadminconfig.states with dbo.organisation details
Section titled “patientadminconfig.states 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 patientadminconfig.states AS mLEFT 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 patientadminconfig.states records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM patientadminconfig.states 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;Records without a matching dbo.organisation
Section titled “Records without a matching dbo.organisation”Find patientadminconfig.states records whose organisationid has no matching dbo.organisation record.
SELECT COUNT(*) AS unmatched_countFROM patientadminconfig.states AS mLEFT 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;