---
title: "SQL-021: Retrieve favorites for one user"
summary: Retrieve favorites for one user
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Business.Menu
reference_type: package
---

# SQL-021: Retrieve favorites for one user

This statement is the `RetrieveByUserIDSQL` implementation of `clsMenuFavoriteCollection.Criteria`, executed from `BeforeRetrieve` against `MENU_FAVORITE`. Retrieve favorites for one user.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-021 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | `[unqualified]`** |
| **Command type** | Text |
| **Business object** | `clsMenuFavoriteCollection` |
| **Criteria property** | `RetrieveByUserIDSQL` |
| **Lifecycle method** | `BeforeRetrieve` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:UserID` | Input | String | 30 | Menu user whose favorites are retrieved |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [MENU_FAVORITE](../database-tables.md#menu_favorite) | SELECT | MENU_FAVORITE_SEQ_NUM, MENU_USER, MENU_USER_EMPLID, MENU_ITEM_SEQ_NUM, MENU_ORDER_NUM, ITEM_INACTIVE_DATE |

## Sample SQL

```sql
-- Retrieve favorites for one user
Select
  MENU_FAVORITE.MENU_FAVORITE_SEQ_NUM as MenuFavoriteSeqNum,
  MENU_FAVORITE.MENU_USER as UserID,
  MENU_FAVORITE.MENU_USER_EMPLID as UserEmplID,
  MENU_FAVORITE.MENU_ITEM_SEQ_NUM as MenuItemSeqNum,
  MENU_FAVORITE.MENU_ORDER_NUM as MenuOrder,
  MENU_FAVORITE.ITEM_INACTIVE_DATE as ItemInactiveDate
From
  MENU_FAVORITE
Where
  MENU_FAVORITE.MENU_USER = :UserID
```

## Operations and processes

- [Load a user's favorites](../operations/op-menu-08-load-user-favorites.md)

## Business rules

- [BR-MENU-001](../business-rules.md#br-menu-001-scoped-vs-unfiltered-retrieval): Scoped vs. unfiltered retrieval

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- SAIF.Business.Menu/clsMenuFavoriteCollection.vb
