Definition
Information
Section titled “Information”The Unscheduledcare Conveyingambulancetrust model holds reference details for conveying ambulance trusts. Each entry records a trust identifier, display name and ODS code, together with organisation information.
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.attendancedetail count per unscheduledcare.conveyingambulancetrust
Section titled “unscheduledcare.attendancedetail count per unscheduledcare.conveyingambulancetrust”Count related unscheduledcare.attendancedetail records for each unscheduledcare.conveyingambulancetrust record, joined on conveyingambulancetrustid.
SELECT m."conveyingambulancetrustid", m."displayname", COUNT(c."conveyingambulancetrustid") AS attendancedetail_countFROM unscheduledcare.conveyingambulancetrust AS mLEFT JOIN unscheduledcare.attendancedetail AS c ON m."conveyingambulancetrustid" = c."conveyingambulancetrustid" AND m."organisation" = c."organisation"GROUP BY m."conveyingambulancetrustid", m."displayname"ORDER BY attendancedetail_count DESC;unscheduledcare.attendancedetail records with unscheduledcare.conveyingambulancetrust details
Section titled “unscheduledcare.attendancedetail records with unscheduledcare.conveyingambulancetrust details”List unscheduledcare.attendancedetail records with the unscheduledcare.conveyingambulancetrust values they reference through conveyingambulancetrustid.
SELECT c."attendancedetailid", c."arrivedon", m."conveyingambulancetrustid", m."displayname" AS "conveyingambulancetrust_displayname"FROM unscheduledcare.attendancedetail AS cINNER JOIN unscheduledcare.conveyingambulancetrust AS m ON m."conveyingambulancetrustid" = c."conveyingambulancetrustid" AND m."organisation" = c."organisation";unscheduledcare.conveyingambulancetrust records not used by unscheduledcare.attendancedetail
Section titled “unscheduledcare.conveyingambulancetrust records not used by unscheduledcare.attendancedetail”Find unscheduledcare.conveyingambulancetrust records that no unscheduledcare.attendancedetail record references.
SELECT m."conveyingambulancetrustid", m."displayname"FROM unscheduledcare.conveyingambulancetrust AS mWHERE NOT EXISTS ( SELECT 1 FROM unscheduledcare.attendancedetail AS c WHERE m."conveyingambulancetrustid" = c."conveyingambulancetrustid" AND m."organisation" = c."organisation");