Skip to content
Partner Developer Portal

Definition

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.

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

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 m
LEFT 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_count
FROM dbo.speciality AS m
LEFT 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_count
FROM dbo.speciality AS m
INNER JOIN accesscontrol.areaofwork AS p
ON p."areaofworkid" = m."areaofworkid"
AND p."organisation" = m."organisation"
GROUP BY p."areaofworkname"
ORDER BY row_count DESC;