Definition
Information
Section titled “Information”The Dbo Organisationspeciality model records associations between organisations and specialities. Each entry holds the organisation identifier and speciality identifier together, alongside the organisation information recorded for that entry, representing an organisation-speciality association rather than the descriptive details of either.
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.organisationspeciality with dbo.organisation and dbo.speciality details
Section titled “dbo.organisationspeciality with dbo.organisation and dbo.speciality details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname", m."specialityid", p2."specialityname" AS "specialityname"FROM dbo.organisationspeciality AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.speciality AS p2 ON p2."specialityid" = m."specialityid" AND p2."organisation" = m."organisation";Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count dbo.organisationspeciality records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM dbo.organisationspeciality 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.speciality specialityname
Section titled “Row count by dbo.speciality specialityname”Count dbo.organisationspeciality records for each dbo.speciality value, joined on specialityid.
SELECT p."specialityname" AS "specialityname", COUNT(*) AS row_countFROM dbo.organisationspeciality AS mINNER JOIN dbo.speciality AS p ON p."specialityid" = m."specialityid" AND p."organisation" = m."organisation"GROUP BY p."specialityname"ORDER BY row_count DESC;