Definition
Information
Section titled “Information”The Consultationmode Consultationstyle model holds named consultation-style definitions and their recorded attributes. It also stores style and parent-style identifiers, owning-organisation and owning-user-role identifiers, and obsolete and system-defined flags, together with the organisation information associated with each consultation style.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”carerecord.consultation count per consultationmode.consultationstyle
Section titled “carerecord.consultation count per consultationmode.consultationstyle”Count related carerecord.consultation records for each consultationmode.consultationstyle record, joined on consultationstyleid.
SELECT m."consultationstyleid", m."name", COUNT(c."consultationstyleid") AS consultation_countFROM consultationmode.consultationstyle AS mLEFT JOIN carerecord.consultation AS c ON m."consultationstyleid" = c."consultationstyleid" AND m."organisation" = c."organisation"GROUP BY m."consultationstyleid", m."name"ORDER BY consultation_count DESC;carerecord.consultation records with consultationmode.consultationstyle details
Section titled “carerecord.consultation records with consultationmode.consultationstyle details”List carerecord.consultation records with the consultationmode.consultationstyle values they reference through consultationstyleid.
SELECT c."consultationid", c."availabilitytimestamp", m."consultationstyleid", m."name" AS "consultationstyle_name"FROM carerecord.consultation AS cINNER JOIN consultationmode.consultationstyle AS m ON m."consultationstyleid" = c."consultationstyleid" AND m."organisation" = c."organisation";consultationmode.consultationstyle records not used by carerecord.consultation
Section titled “consultationmode.consultationstyle records not used by carerecord.consultation”Find consultationmode.consultationstyle records that no carerecord.consultation record references.
SELECT m."consultationstyleid", m."name"FROM consultationmode.consultationstyle AS mWHERE NOT EXISTS ( SELECT 1 FROM carerecord.consultation AS c WHERE m."consultationstyleid" = c."consultationstyleid" AND m."organisation" = c."organisation");