Skip to content
Partner Developer Portal

Definition

The Unscheduledcare Safeguardingconcern model records coded safeguarding concerns associated with attendance details. Each entry holds an attendance-detail identifier and code identifier together, alongside the organisation information recorded for that entry, representing the coded concern association rather than a narrative description.

_deleted indicates whether the record has been deleted in the source system.

unscheduledcare.safeguardingconcern with unscheduledcare.attendancedetail details

Section titled “unscheduledcare.safeguardingconcern with unscheduledcare.attendancedetail details”

Return records alongside descriptive values from the related unscheduledcare.attendancedetail record.

SELECT
m."_primary_key",
m."attendancedetailid",
p1."accompaniedbyname" AS "attendancedetail_accompaniedbyname"
FROM unscheduledcare.safeguardingconcern AS m
LEFT JOIN unscheduledcare.attendancedetail AS p1
ON p1."attendancedetailid" = m."attendancedetailid"
AND p1."organisation" = m."organisation";

Row count by unscheduledcare.attendancedetail accompaniedbyname

Section titled “Row count by unscheduledcare.attendancedetail accompaniedbyname”

Count unscheduledcare.safeguardingconcern records for each unscheduledcare.attendancedetail value, joined on attendancedetailid.

SELECT
p."accompaniedbyname" AS "attendancedetail_accompaniedbyname",
COUNT(*) AS row_count
FROM unscheduledcare.safeguardingconcern AS m
INNER JOIN unscheduledcare.attendancedetail AS p
ON p."attendancedetailid" = m."attendancedetailid"
AND p."organisation" = m."organisation"
GROUP BY p."accompaniedbyname"
ORDER BY row_count DESC;

Records without a matching unscheduledcare.attendancedetail

Section titled “Records without a matching unscheduledcare.attendancedetail”

Find unscheduledcare.safeguardingconcern records whose attendancedetailid has no matching unscheduledcare.attendancedetail record.

SELECT
COUNT(*) AS unmatched_count
FROM unscheduledcare.safeguardingconcern AS m
LEFT JOIN unscheduledcare.attendancedetail AS p
ON p."attendancedetailid" = m."attendancedetailid"
AND p."organisation" = m."organisation"
WHERE m."attendancedetailid" IS NOT NULL
AND p."attendancedetailid" IS NULL;