Definition
Information
Section titled “Information”The Bedmanagement Colour model holds colour definitions for bed management. Each entry records red, green, blue and alpha component values, a colour 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.bed count per bedmanagement.colour
Section titled “bedmanagement.bed count per bedmanagement.colour”Count related bedmanagement.bed records for each bedmanagement.colour record, joined on colourid.
SELECT m."colourid", m."alpha", COUNT(c."colourid") AS bed_countFROM bedmanagement.colour AS mLEFT JOIN bedmanagement.bed AS c ON m."colourid" = c."colourid" AND m."organisation" = c."organisation"GROUP BY m."colourid", m."alpha"ORDER BY bed_count DESC;bedmanagement.bed records with bedmanagement.colour details
Section titled “bedmanagement.bed records with bedmanagement.colour details”List bedmanagement.bed records with the bedmanagement.colour values they reference through colourid.
SELECT c."bedid", m."colourid", m."alpha" AS "colour_alpha"FROM bedmanagement.bed AS cINNER JOIN bedmanagement.colour AS m ON m."colourid" = c."colourid" AND m."organisation" = c."organisation";bedmanagement.colour records not used by bedmanagement.bed
Section titled “bedmanagement.colour records not used by bedmanagement.bed”Find bedmanagement.colour records that no bedmanagement.bed record references.
SELECT m."colourid", m."alpha"FROM bedmanagement.colour AS mWHERE NOT EXISTS ( SELECT 1 FROM bedmanagement.bed AS c WHERE m."colourid" = c."colourid" AND m."organisation" = c."organisation");