Definition
Information
Section titled “Information”The Dbo Speciality model holds speciality definitions, including names, abbreviations and national codes. It records area-of-work, code and folder identifiers, search information and flags for obsolescence and implementation in EMIS Web, together with speciality identifiers and organisation information.
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.speciality with accesscontrol.areaofwork details
Section titled “dbo.speciality with accesscontrol.areaofwork details”Return records alongside descriptive values from the related accesscontrol.areaofwork record.
SELECT m."specialityid", m."areaofworkid", p1."areaofworkname" AS "areaofworkname"FROM dbo.speciality AS mLEFT JOIN accesscontrol.areaofwork AS p1 ON p1."areaofworkid" = m."areaofworkid" AND p1."organisation" = m."organisation";dbo.organisationspeciality count per dbo.speciality
Section titled “dbo.organisationspeciality count per dbo.speciality”Count related dbo.organisationspeciality records for each dbo.speciality record, joined on specialityid.
SELECT m."specialityid", m."specialityname", COUNT(c."specialityid") AS organisationspeciality_countFROM dbo.speciality AS mLEFT JOIN dbo.organisationspeciality AS c ON m."specialityid" = c."specialityid" AND m."organisation" = c."organisation"GROUP BY m."specialityid", m."specialityname"ORDER BY organisationspeciality_count DESC;Row count by accesscontrol.areaofwork areaofworkname
Section titled “Row count by accesscontrol.areaofwork areaofworkname”Count dbo.speciality records for each accesscontrol.areaofwork value, joined on areaofworkid.
SELECT p."areaofworkname" AS "areaofworkname", COUNT(*) AS row_countFROM dbo.speciality AS mINNER JOIN accesscontrol.areaofwork AS p ON p."areaofworkid" = m."areaofworkid" AND p."organisation" = m."organisation"GROUP BY p."areaofworkname"ORDER BY row_count DESC;