Skip to content
Partner Developer Portal

Definition

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.

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

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 m
LEFT 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_count
FROM dbo.organisationuser 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;

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_count
FROM dbo.organisationuser AS m
INNER JOIN dbo.userinrole AS p
ON p."userinroleid" = m."userinroleid"
AND p."organisation" = m."organisation"
GROUP BY p."contractualrelationship"
ORDER BY row_count DESC;