Definition
Information
Section titled “Information”The Dbo Organisationuser model records associations between organisations and users in their recorded roles. Each entry holds an organisation identifier and user-in-role identifier together, alongside the organisation information recorded for that entry, describing the association rather than personal user details.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”dbo.organisationuser with dbo.organisation and dbo.userinrole details
Section titled “dbo.organisationuser with dbo.organisation and dbo.userinrole details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname", m."userinroleid", p2."contractualrelationship" AS "userinrole_contractualrelationship"FROM dbo.organisationuser AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.userinrole AS p2 ON p2."userinroleid" = m."userinroleid" AND p2."organisation" = m."organisation";Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count dbo.organisationuser records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM dbo.organisationuser 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;Row count by dbo.userinrole contractualrelationship
Section titled “Row count by dbo.userinrole contractualrelationship”Count dbo.organisationuser records for each dbo.userinrole value, joined on userinroleid.
SELECT p."contractualrelationship" AS "userinrole_contractualrelationship", COUNT(*) AS row_countFROM dbo.organisationuser AS mINNER JOIN dbo.userinrole AS p ON p."userinroleid" = m."userinroleid" AND p."organisation" = m."organisation"GROUP BY p."contractualrelationship"ORDER BY row_count DESC;