---
title: "SQL-020: Retrieve favorites by user ID"
summary: Retrieves all MENU_FAVORITE records for a specific user.
status: draft
owner: SAIF
last_reviewed: 2026-07-24
library: SAIF.Business.Menu
reference_type: package
---

# SQL-020: Retrieve favorites by user ID

Retrieves all menu favorite records for a specific user from `MENU_FAVORITE`, filtered by `MENU_USER`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-020 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | `[unqualified]**` |
| **Command type** | Text |
| **Business object** | `clsMenuFavoriteCollection` |
| **Criteria property** | `RetrieveByUserIDSQL` |
| **Lifecycle method** | `BeforeRetrieve` (UserID.Trim.Length > 0) / `AfterRetrieve` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:UserID` | Input | String** | 30 | User login bound from `MyCriteria.UserID`. |

## 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
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
- [Favorite menu management](../operations/favorite-menu-management.md)



> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.Menu\clsMenuFavoriteCollection.vb`
