Definition
Information
Section titled “Information”The Episodemanagement Episodetitle model holds episode-title definitions and their descriptive text. Each entry records title identifiers, a status 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”episodemanagement.episodetitle with appointment.status details
Section titled “episodemanagement.episodetitle with appointment.status details”Return records alongside descriptive values from the related appointment.status record.
SELECT m."episodetitleid", m."statusid", p1."description" AS "status_description"FROM episodemanagement.episodetitle AS mLEFT JOIN appointment.status AS p1 ON p1."statusid" = m."statusid" AND p1."organisation" = m."organisation";episodemanagement.organisationcarepathwayepisodetitle count per episodemanagement.episodetitle
Section titled “episodemanagement.organisationcarepathwayepisodetitle count per episodemanagement.episodetitle”Count related episodemanagement.organisationcarepathwayepisodetitle records for each episodemanagement.episodetitle record, joined on episodetitleid.
SELECT m."episodetitleid", m."description", COUNT(c."episodetitleid") AS organisationcarepathwayepisodetitle_countFROM episodemanagement.episodetitle AS mLEFT JOIN episodemanagement.organisationcarepathwayepisodetitle AS c ON m."episodetitleid" = c."episodetitleid" AND m."organisation" = c."organisation"GROUP BY m."episodetitleid", m."description"ORDER BY organisationcarepathwayepisodetitle_count DESC;Row count by appointment.status description
Section titled “Row count by appointment.status description”Count episodemanagement.episodetitle records for each appointment.status value, joined on statusid.
SELECT p."description" AS "status_description", COUNT(*) AS row_countFROM episodemanagement.episodetitle AS mINNER JOIN appointment.status AS p ON p."statusid" = m."statusid" AND p."organisation" = m."organisation"GROUP BY p."description"ORDER BY row_count DESC;