Skip to content
Partner Developer Portal

Definition

The Dbo Address model holds postal address details, including building or flat information, street, village, town, county and country code. It also records the postcode with and without spaces, address identifiers and search information, together with organisation information.

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

Count related dbo.location records for each dbo.address record, joined on addressid.

SELECT
m."addressid",
m."countrycode",
COUNT(c."addressid") AS location_count
FROM dbo.address AS m
LEFT JOIN dbo.location AS c
ON m."addressid" = c."addressid"
AND m."organisation" = c."organisation"
GROUP BY m."addressid", m."countrycode"
ORDER BY location_count DESC;

dbo.location records with dbo.address details

Section titled “dbo.location records with dbo.address details”

List dbo.location records with the dbo.address values they reference through addressid.

SELECT
c."locationid",
c."closedate",
m."addressid",
m."countrycode" AS "address_countrycode"
FROM dbo.location AS c
INNER JOIN dbo.address AS m
ON m."addressid" = c."addressid"
AND m."organisation" = c."organisation";

dbo.patientadditionaladdress count per dbo.address

Section titled “dbo.patientadditionaladdress count per dbo.address”

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

SELECT
m."addressid",
m."countrycode",
COUNT(c."addressid") AS patientadditionaladdress_count
FROM dbo.address AS m
LEFT JOIN dbo.patientadditionaladdress AS c
ON m."addressid" = c."addressid"
AND m."organisation" = c."organisation"
GROUP BY m."addressid", m."countrycode"
ORDER BY patientadditionaladdress_count DESC;