Definition
Information
Section titled “Information”The Appointment Sessionlocation model links appointment sessions with their recorded locations. Each association contains the session and location identifiers together with source organisation information, identifying the session’s recorded location association and the organisational context in which it is stored.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”appointment.sessionlocation with dbo.location and appointment.session details
Section titled “appointment.sessionlocation with dbo.location and appointment.session details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."locationid", p1."locationname" AS "locationname", m."sessionid", p2."description" AS "session_description"FROM appointment.sessionlocation AS mLEFT JOIN dbo.location AS p1 ON p1."locationid" = m."locationid" AND p1."organisation" = m."organisation"LEFT JOIN appointment.session AS p2 ON p2."sessionid" = m."sessionid" AND p2."organisation" = m."organisation";Row count by dbo.location locationname
Section titled “Row count by dbo.location locationname”Count appointment.sessionlocation records for each dbo.location value, joined on locationid.
SELECT p."locationname" AS "locationname", COUNT(*) AS row_countFROM appointment.sessionlocation 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;Row count by appointment.session description
Section titled “Row count by appointment.session description”Count appointment.sessionlocation records for each appointment.session value, joined on sessionid.
SELECT p."description" AS "session_description", COUNT(*) AS row_countFROM appointment.sessionlocation AS mINNER JOIN appointment.session AS p ON p."sessionid" = m."sessionid" AND p."organisation" = m."organisation"GROUP BY p."description"ORDER BY row_count DESC;