Skip to content
Partner Developer Portal

Definition

The Dbo Alternatecorrespondenceformat model holds descriptions of alternate correspondence formats. Each entry records a format identifier and its description, together with organisation information.

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

dbo.patient count per dbo.alternatecorrespondenceformat

Section titled “dbo.patient count per dbo.alternatecorrespondenceformat”

Count related dbo.patient records for each dbo.alternatecorrespondenceformat record, joined on alternatecorrespondenceformat.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
m."formatid",
m."formatdescription",
COUNT(c."alternatecorrespondenceformat") AS patient_count
FROM dbo.alternatecorrespondenceformat AS m
LEFT JOIN dbo.patient AS c
ON m."formatid" = c."alternatecorrespondenceformat"
AND m."organisation" = c."organisation"
GROUP BY m."formatid", m."formatdescription"
ORDER BY patient_count DESC;

dbo.patient records with dbo.alternatecorrespondenceformat details

Section titled “dbo.patient records with dbo.alternatecorrespondenceformat details”

List dbo.patient records with the dbo.alternatecorrespondenceformat values they reference through alternatecorrespondenceformat.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
c."patientid",
c."datearchived",
m."formatid",
m."formatdescription" AS "alternatecorrespondenceformat_formatdescription"
FROM dbo.patient AS c
INNER JOIN dbo.alternatecorrespondenceformat AS m
ON m."formatid" = c."alternatecorrespondenceformat"
AND m."organisation" = c."organisation";

dbo.alternatecorrespondenceformat records not used by dbo.patient

Section titled “dbo.alternatecorrespondenceformat records not used by dbo.patient”

Find dbo.alternatecorrespondenceformat records that no dbo.patient record references.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
m."formatid",
m."formatdescription"
FROM dbo.alternatecorrespondenceformat AS m
WHERE NOT EXISTS (
SELECT 1
FROM dbo.patient AS c
WHERE m."formatid" = c."alternatecorrespondenceformat"
AND m."organisation" = c."organisation"
);