Definition
Information
Section titled “Information”The Appointment Session model records appointment sessions, including their description, start and end times, location and notes. It also holds default slot duration and type, session category and type identifiers, recurrence information, and recorded settings for timing, privacy, slot-number display and EMIS Access visibility.
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.session with dbo.location, dbo.organisation and appointment.sessioncategory details
Section titled “appointment.session with dbo.location, dbo.organisation and appointment.sessioncategory details”Return records alongside descriptive values from the related tables.
SELECT m."sessionid", m."locationid", p1."locationname" AS "locationname", m."organisationid", p2."organisationdisplayname" AS "organisationdisplayname", m."sessioncategoryid", p3."displayname" AS "sessioncategory_displayname"FROM appointment.session 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"LEFT JOIN appointment.sessioncategory AS p3 ON p3."sessioncategoryid" = m."sessioncategoryid" AND p3."organisation" = m."organisation";appointment.sessionlocation count per appointment.session
Section titled “appointment.sessionlocation count per appointment.session”Count related appointment.sessionlocation records for each appointment.session record, joined on sessionid.
SELECT m."sessionid", m."description", COUNT(c."sessionid") AS sessionlocation_countFROM appointment.session AS mLEFT JOIN appointment.sessionlocation AS c ON m."sessionid" = c."sessionid" AND m."organisation" = c."organisation"GROUP BY m."sessionid", m."description"ORDER BY sessionlocation_count DESC;Row count by dbo.location locationname
Section titled “Row count by dbo.location locationname”Count appointment.session records for each dbo.location value, joined on locationid.
SELECT p."locationname" AS "locationname", COUNT(*) AS row_countFROM appointment.session 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;