---
title: "SQL-036: External-user last-logon/user lookup family*"
summary: External-user last-logon/user lookup family*.
status: draft
owner: SAIF
last_reviewed: 2026-07-24
library: SAIF.Business
reference_type: package
---

# SQL-036: External-user last-logon/user lookup family*

This document describes `SQL-036`, the external-user last-logon/user lookup family* statement or call used by `SAIF.Business`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-036 |
| **Operation type** | Read |
| **Execution method** | Inline |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `ExternalUserServices` |
| **Criteria property** | `N/A` |
| **Lifecycle method** | `GetLastLogonsByCustomer, GetUsersByCustomer` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:customerGroupID | :customerID`, `:code0..:codeN` | Input | String | 20 / 5 |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EXT_USER](../database-tables.md#ext-user-ext-user-type) | SELECT | See sample SQL and source implementation. |
| [EXT_USER_TYPE](../database-tables.md#ext-user-ext-user-type) | SELECT | See sample SQL and source implementation. |

## Sample SQL

```sql
SELECT u.active_directory_id, u.last_logon_date, t.ext_user_type_code, u.test_user_flag
  FROM ext_user u
  JOIN ext_user_type t ON t.ext_user_seq_num = u.ext_user_seq_num
 WHERE t.customer_group_id = :customerGroupID
   AND t.ext_user_type_code IN (:code0[, :code1, :code2])
 ORDER BY u.test_user_flag, u.last_logon_date DESC
```
`GetUsersByCustomer` substitutes `t.customer_id = :customerID` and uses the same dynamic `IN (:codeN...)` assembly.

## Operations and processes
- [Address validation and external-user reporting](../operations/user-access-and-external-user-reporting.md)

## Business rules
- [BR-SB-007: Production external-user queries hide test users](../business-rules.md#br-sb-007-production-external-user-queries-hide-test-users)

> **Note:** Statements marked with `*` are inferred from code behavior rather than explicit documentation or comments; statements marked with `**` could not be confirmed and should be treated as unknown until verified.

## Sources
- `Business\SAIF.Business\Services\ExternalUserServices.vb`
