Definition
Information
Section titled “Information”The Unscheduledcare Attendanceaction model records actions associated with unscheduled-care attendances and their detail records. It holds action, filing and deletion dates, actioning and deleting user-role identifiers and a cancelled flag, alongside location, request-procedure, outcome-procedure and outcome-request action identifiers.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”unscheduledcare.attendanceaction with unscheduledcare.attendancedetail, dbo.location and unscheduledcare.attendance details
Section titled “unscheduledcare.attendanceaction with unscheduledcare.attendancedetail, dbo.location and unscheduledcare.attendance details”Return records alongside descriptive values from the related tables.
SELECT m."attendanceactionid", m."attendancedetailid", p1."accompaniedbyname" AS "attendancedetail_accompaniedbyname", m."locationid", p2."locationname" AS "locationname", m."attendanceid"FROM unscheduledcare.attendanceaction AS mLEFT JOIN unscheduledcare.attendancedetail AS p1 ON p1."attendancedetailid" = m."attendancedetailid" AND p1."organisation" = m."organisation"LEFT JOIN dbo.location AS p2 ON p2."locationid" = m."locationid" AND p2."organisation" = m."organisation"LEFT JOIN unscheduledcare.attendance AS p3 ON p3."attendanceid" = m."attendanceid" AND p3."organisation" = m."organisation";Row count by unscheduledcare.attendancedetail accompaniedbyname
Section titled “Row count by unscheduledcare.attendancedetail accompaniedbyname”Count unscheduledcare.attendanceaction records for each unscheduledcare.attendancedetail value, joined on attendancedetailid.
SELECT p."accompaniedbyname" AS "attendancedetail_accompaniedbyname", COUNT(*) AS row_countFROM unscheduledcare.attendanceaction AS mINNER JOIN unscheduledcare.attendancedetail AS p ON p."attendancedetailid" = m."attendancedetailid" AND p."organisation" = m."organisation"GROUP BY p."accompaniedbyname"ORDER BY row_count DESC;Row count by dbo.location locationname
Section titled “Row count by dbo.location locationname”Count unscheduledcare.attendanceaction records for each dbo.location value, joined on locationid.
SELECT p."locationname" AS "locationname", COUNT(*) AS row_countFROM unscheduledcare.attendanceaction 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;