SQL on FHIR
2.1.0-pre - release
SQL on FHIR, published by SQL on FHIR Working Group. This guide is not an authorized publication; it is the continuous build for version 2.1.0-pre built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/sql-on-fhir/ and changes regularly. See the Directory of published versions
| Active as of 2026-06-13 |
<Library xmlns="http://hl7.org/fhir">
<id value="ActivePatientAddressesQuery"/>
<meta>
<profile value="https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery"/>
</meta>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: Library ActivePatientAddressesQuery</b></p><a name="ActivePatientAddressesQuery"> </a><a name="hcActivePatientAddressesQuery"> </a><div style="display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%"><p style="margin-bottom: 0px"/><p style="margin-bottom: 0px">Profile: <a href="StructureDefinition-SQLQuery.html">SQL Query Library</a></p></div><h2>Related Artifacts</h2><table class="grid"><tr><td>Depends On</td><td>active_patients</td><td>Active Patients view</td><td><a href="Library-ActivePatientsView.html">Active Patients</a></td></tr><tr><td>Depends On</td><td>patient_address_view</td><td>Patient address view</td><td><code>https://example.org/ViewDefinition/patient_address_view</code></td></tr></table><h2>Contents</h2><p><code>application/sql</code></p><pre><code>SELECT
active_patients.patient_id,
active_patients.patient_name,
patient_address_view.city,
patient_address_view.state
FROM active_patients
JOIN patient_address_view
ON active_patients.patient_id = patient_address_view.patient_id</code></pre></div>
</text>
<url
value="https://sql-on-fhir.org/ig/Library/ActivePatientAddressesQuery"/>
<version value="2.1.0-pre"/>
<name value="ActivePatientAddressesQuery"/>
<title value="Active Patient Addresses"/>
<status value="active"/>
<type>
<coding>
<system
value="https://sql-on-fhir.org/ig/CodeSystem/LibraryTypesCodes"/>
<code value="sql-query"/>
</coding>
</type>
<date value="2026-06-13T00:26:08+00:00"/>
<publisher value="SQL on FHIR Working Group"/>
<contact>
<name value="SQL on FHIR Working Group"/>
<telecom>
<system value="url"/>
<value value="https://sql-on-fhir.org"/>
</telecom>
</contact>
<description
value="Joins the [Active Patients](Library-ActivePatientsView.html) view to patient
addresses. The `active_patients` label resolves to the referenced SQLView, which
the executing engine may materialise or inline.
```sql
SELECT
active_patients.patient_id,
active_patients.patient_name,
patient_address_view.city,
patient_address_view.state
FROM active_patients
JOIN patient_address_view
ON active_patients.patient_id = patient_address_view.patient_id
```"/>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
<display value="World"/>
</coding>
</jurisdiction>
<relatedArtifact>
<type value="depends-on"/>
<label value="active_patients"/>
<display value="Active Patients view"/>
<resource value="https://sql-on-fhir.org/ig/Library/ActivePatientsView"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<label value="patient_address_view"/>
<display value="Patient address view"/>
<resource
value="https://example.org/ViewDefinition/patient_address_view"/>
</relatedArtifact>
<content>
<extension url="https://sql-on-fhir.org/ig/StructureDefinition/sql-text">
<valueString
value="SELECT
active_patients.patient_id,
active_patients.patient_name,
patient_address_view.city,
patient_address_view.state
FROM active_patients
JOIN patient_address_view
ON active_patients.patient_id = patient_address_view.patient_id"/>
</extension>
<contentType value="application/sql"/>
<data
value="U0VMRUNUCiAgYWN0aXZlX3BhdGllbnRzLnBhdGllbnRfaWQsCiAgYWN0aXZlX3BhdGllbnRzLnBhdGllbnRfbmFtZSwKICBwYXRpZW50X2FkZHJlc3Nfdmlldy5jaXR5LAogIHBhdGllbnRfYWRkcmVzc192aWV3LnN0YXRlCkZST00gYWN0aXZlX3BhdGllbnRzCkpPSU4gcGF0aWVudF9hZGRyZXNzX3ZpZXcKICBPTiBhY3RpdmVfcGF0aWVudHMucGF0aWVudF9pZCA9IHBhdGllbnRfYWRkcmVzc192aWV3LnBhdGllbnRfaWQ="/>
</content>
</Library>