Definition
Information
Section titled “Information”The Bedmanagement Bedstatus model holds bed status definitions and their descriptions. Each entry records a bed-status identifier together with descriptive text 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.bed count per bedmanagement.bedstatus
Section titled “bedmanagement.bed count per bedmanagement.bedstatus”Count related bedmanagement.bed records for each bedmanagement.bedstatus record, joined on bedstatusid.
SELECT m."bedstatusid", m."bedstatusdescription", COUNT(c."bedstatusid") AS bed_countFROM bedmanagement.bedstatus AS mLEFT JOIN bedmanagement.bed AS c ON m."bedstatusid" = c."bedstatusid" AND m."organisation" = c."organisation"GROUP BY m."bedstatusid", m."bedstatusdescription"ORDER BY bed_count DESC;bedmanagement.bed records with bedmanagement.bedstatus details
Section titled “bedmanagement.bed records with bedmanagement.bedstatus details”List bedmanagement.bed records with the bedmanagement.bedstatus values they reference through bedstatusid.
SELECT c."bedid", m."bedstatusid", m."bedstatusdescription" AS "bedstatusdescription"FROM bedmanagement.bed AS cINNER JOIN bedmanagement.bedstatus AS m ON m."bedstatusid" = c."bedstatusid" AND m."organisation" = c."organisation";bedmanagement.bedstatushistory count per bedmanagement.bedstatus
Section titled “bedmanagement.bedstatushistory count per bedmanagement.bedstatus”Count related bedmanagement.bedstatushistory records for each bedmanagement.bedstatus record, joined on bedstatusid.
SELECT m."bedstatusid", m."bedstatusdescription", COUNT(c."bedstatusid") AS bedstatushistory_countFROM bedmanagement.bedstatus AS mLEFT JOIN bedmanagement.bedstatushistory AS c ON m."bedstatusid" = c."bedstatusid" AND m."organisation" = c."organisation"GROUP BY m."bedstatusid", m."bedstatusdescription"ORDER BY bedstatushistory_count DESC;