Definition
Information
Section titled “Information”The Appointment Sessioncategory model holds appointment session categories and their display names. It records category identifiers and organisation details, together with flags for mobile availability, list use and deletion that describe the settings stored against each category.
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.sessioncategory with dbo.organisation details
Section titled “appointment.sessioncategory with dbo.organisation details”Return records alongside descriptive values from the related dbo.organisation record.
SELECT m."sessioncategoryid", m."organisationid", p1."organisationdisplayname" AS "organisationdisplayname"FROM appointment.sessioncategory AS mLEFT JOIN dbo.organisation AS p1 ON p1."organisationid" = m."organisationid" AND p1."organisation" = m."organisation";appointment.session count per appointment.sessioncategory
Section titled “appointment.session count per appointment.sessioncategory”Count related appointment.session records for each appointment.sessioncategory record, joined on sessioncategoryid.
SELECT m."sessioncategoryid", m."displayname", COUNT(c."sessioncategoryid") AS session_countFROM appointment.sessioncategory AS mLEFT JOIN appointment.session AS c ON m."sessioncategoryid" = c."sessioncategoryid" AND m."organisation" = c."organisation"GROUP BY m."sessioncategoryid", m."displayname"ORDER BY session_count DESC;Row count by dbo.organisation organisationdisplayname
Section titled “Row count by dbo.organisation organisationdisplayname”Count appointment.sessioncategory records for each dbo.organisation value, joined on organisationid.
SELECT p."organisationdisplayname" AS "organisationdisplayname", COUNT(*) AS row_countFROM appointment.sessioncategory AS mINNER JOIN dbo.organisation AS p ON p."organisationid" = m."organisationid" AND p."organisation" = m."organisation"GROUP BY p."organisationdisplayname"ORDER BY row_count DESC;