Definition
Information
Section titled “Information”The Bedmanagement Bedfeature model holds bed-feature definitions, including their codes and descriptions. Each entry records a feature identifier, organisation identifier and source 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”bedmanagement.bedfeature with dbo.organisation details
Section titled “bedmanagement.bedfeature with dbo.organisation details”Return records alongside descriptive values from the related dbo.organisation record.
SELECT m."bedfeatureid", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname"FROM bedmanagement.bedfeature AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation";bedmanagement.bedhasfeature count per bedmanagement.bedfeature
Section titled “bedmanagement.bedhasfeature count per bedmanagement.bedfeature”Count related bedmanagement.bedhasfeature records for each bedmanagement.bedfeature record, joined on bedfeatureid.
SELECT m."bedfeatureid", m."description", COUNT(c."bedfeatureid") AS bedhasfeature_countFROM bedmanagement.bedfeature AS mLEFT JOIN bedmanagement.bedhasfeature AS c ON m."bedfeatureid" = c."bedfeatureid" AND m."organisation" = c."organisation"GROUP BY m."bedfeatureid", m."description"ORDER BY bedhasfeature_count DESC;Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count bedmanagement.bedfeature records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM bedmanagement.bedfeature 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;