Skip to content
Partner Developer Portal

Definition

The Dbo Patientadditionaladdress model records additional address associations for patients, including address-type and secondary-address-type identifiers. It holds effective-from and effective-to dates with their date-part values, correspondence and legacy-data flags and notes, together with patient, address and association identifiers.

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

dbo.patientadditionaladdress with dbo.address, dbo.addresstype and dbo.patient details

Section titled “dbo.patientadditionaladdress with dbo.address, dbo.addresstype and dbo.patient details”

Return records alongside descriptive values from the related tables.

SELECT
m."patientadditionaladdressid",
m."addressid",
p1."countrycode" AS "address_countrycode",
m."addresstypeid",
p2."addresstypedescription" AS "addresstypedescription",
m."patientid",
p3."displayname" AS "patient_displayname"
FROM dbo.patientadditionaladdress AS m
LEFT JOIN dbo.address AS p1
ON p1."addressid" = m."addressid"
AND p1."organisation" = m."organisation"
LEFT JOIN dbo.addresstype AS p2
ON p2."addresstypeid" = m."addresstypeid"
AND p2."organisation" = m."organisation"
LEFT JOIN dbo.patient AS p3
ON p3."patientid" = m."patientid"
AND p3."organisation" = m."organisation";

Count dbo.patientadditionaladdress records for each dbo.address value, joined on addressid.

SELECT
p."countrycode" AS "address_countrycode",
COUNT(*) AS row_count
FROM dbo.patientadditionaladdress AS m
INNER JOIN dbo.address AS p
ON p."addressid" = m."addressid"
AND p."organisation" = m."organisation"
GROUP BY p."countrycode"
ORDER BY row_count DESC;

Row count by dbo.addresstype addresstypedescription

Section titled “Row count by dbo.addresstype addresstypedescription”

Count dbo.patientadditionaladdress records for each dbo.addresstype value, joined on addresstypeid.

SELECT
p."addresstypedescription" AS "addresstypedescription",
COUNT(*) AS row_count
FROM dbo.patientadditionaladdress AS m
INNER JOIN dbo.addresstype AS p
ON p."addresstypeid" = m."addresstypeid"
AND p."organisation" = m."organisation"
GROUP BY p."addresstypedescription"
ORDER BY row_count DESC;