Definition
Information
Section titled “Information”The Episodemanagement Groupsession model records group sessions, including their date and time, duration, participant count and location. It also holds session-type and location-type code identifiers, commissioner and organisation identifiers, an appointment-session identifier and a cancellation-reason code identifier.
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.groupsession with dbo.location and dbo.organisation details
Section titled “episodemanagement.groupsession with dbo.location and dbo.organisation details”Return records alongside descriptive values from the related tables.
SELECT m."groupsessionid", m."locationid", p1."locationname" AS "locationname", m."organisationid", p2."organisationdisplayname" AS "organisationdisplayname"FROM episodemanagement.groupsession AS mLEFT JOIN dbo.location AS p1 ON p1."locationid" = m."locationid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.organisation AS p2 ON p2."organisationid" = m."organisationid" AND p2."organisation" = m."organisation";episodemanagement.groupsessioncareprofessional count per episodemanagement.groupsession
Section titled “episodemanagement.groupsessioncareprofessional count per episodemanagement.groupsession”Count related episodemanagement.groupsessioncareprofessional records for each episodemanagement.groupsession record, joined on groupsessionid.
SELECT m."groupsessionid", m."numberofparticipants", COUNT(c."groupsessionid") AS groupsessioncareprofessional_countFROM episodemanagement.groupsession AS mLEFT JOIN episodemanagement.groupsessioncareprofessional AS c ON m."groupsessionid" = c."groupsessionid" AND m."organisation" = c."organisation"GROUP BY m."groupsessionid", m."numberofparticipants"ORDER BY groupsessioncareprofessional_count DESC;Row count by dbo.location locationname
Section titled “Row count by dbo.location locationname”Count episodemanagement.groupsession records for each dbo.location value, joined on locationid.
SELECT p."locationname" AS "locationname", COUNT(*) AS row_countFROM episodemanagement.groupsession AS mINNER JOIN dbo.location AS p ON p."locationid" = m."locationid" AND p."organisation" = m."organisation"GROUP BY p."locationname"ORDER BY row_count DESC;