---
title: "SQL-214: ProviderQueryProvider.GetActiveWorkingRelationshipsForProvider"
summary: Read operation for `ProviderQueryProvider.GetActiveWorkingRelationshipsForProvider`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-214: ProviderQueryProvider.GetActiveWorkingRelationshipsForProvider

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `ProviderQueryProvider.GetActiveWorkingRelationshipsForProvider`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-214 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `ProviderQueryProvider` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `GetActiveWorkingRelationshipsForProvider` |


## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PROVIDER_RELATIONSHIP](../database-tables.md#provider_relationship) | SELECT | PROVIDER_LOCATION_SEQ_NUM, PARENT_PROVIDER_LOC_SEQ_NUM, EFF_DATE, UPDATE_NUM, EXP_DATE, UPDATE_DATE, UPDATE_USER, PROVIDER_RELATIONSHIP_CODE |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:205-208`.

```csharp
public IEnumerable<ProviderRelationship> GetActiveWorkingRelationshipsForProvider(long providerLocationId)
{
    return Factory.GetRepository<ProviderRelationship>().Query()
        .Where(r =>
            r.Relationship.Code == WorkingRelationship &&
            r.ExpirationDate == null).ToList();
}
```

## Sample SQL

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
  PR.PROVIDER_LOCATION_SEQ_NUM,
  PR.PARENT_PROVIDER_LOC_SEQ_NUM,
  PR.EFF_DATE,
  PR.UPDATE_NUM,
  PR.EXP_DATE,
  PR.UPDATE_DATE,
  PR.UPDATE_USER,
  PR.PROVIDER_RELATIONSHIP_CODE
FROM PROVIDER_RELATIONSHIP PR
WHERE PR.PROVIDER_RELATIONSHIP_CODE = 'WRK'
  AND PR.EXP_DATE IS NULL
```

Translation notes:
- The `providerLocationId` argument is **ignored**; the predicate does not reference it, so every active working relationship in the table is returned. Record this as a likely code defect.

## Operations and processes

- [Provider queries](../operations/provider-queries.md)

## Business rules

- [SD-BR-080 Provider identity relationship and address code sets](../business-rules.md#sd-br-080-provider-identity-relationship-and-address-code-sets)
- [SD-BR-082 Dismissed bills excluded from provider location ids](../business-rules.md#sd-br-082-dismissed-bills-excluded-from-provider-location-ids)
- [SD-BR-083 Provider in MCO only within date window](../business-rules.md#sd-br-083-provider-in-mco-only-within-date-window)

## Sources
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:205`
