Definition
Information
Section titled “Information”The Dbo Patientaddress model records address information associated with patients, including address-type and secondary-address-type identifiers. It holds an effective-from date and date-part value, access instructions and notes, together with the patient and address identifiers and organisation information for the entry.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”dbo.patientaddress with dbo.address, dbo.addresstype and dbo.patient details
Section titled “dbo.patientaddress with dbo.address, dbo.addresstype and dbo.patient details”Return records alongside descriptive values from the related tables.
SELECT m."_primary_key", m."addressid", p1."countrycode" AS "address_countrycode", m."addresstypeid", p2."addresstypedescription" AS "addresstypedescription", m."patientid", p3."displayname" AS "patient_displayname"FROM dbo.patientaddress AS mLEFT 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";Row count by dbo.address countrycode
Section titled “Row count by dbo.address countrycode”Count dbo.patientaddress records for each dbo.address value, joined on addressid.
SELECT p."countrycode" AS "address_countrycode", COUNT(*) AS row_countFROM dbo.patientaddress AS mINNER 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.patientaddress records for each dbo.addresstype value, joined on addresstypeid.
SELECT p."addresstypedescription" AS "addresstypedescription", COUNT(*) AS row_countFROM dbo.patientaddress AS mINNER JOIN dbo.addresstype AS p ON p."addresstypeid" = m."addresstypeid" AND p."organisation" = m."organisation"GROUP BY p."addresstypedescription"ORDER BY row_count DESC;