# GET_TREE() Function

### Description

Returns hierarchy tree values for org-structure filtering (Rippling-specific).

### Syntax

```sql
GET_TREE(tree_type, root_id, field, [include_terminated])
```

### Parameters

| Parameter | Description | Data Type | Required |
| --- | --- | --- | --- |
| _tree\_type_ | Hierarchy type to expand (e.g. Department, Manager, Team) | String | Yes |
| _root\_id_ | Root node ID to expand from | String | Yes |
| _field_ | Field to return from each node (e.g. id, name) | String | Yes |
| _include\_terminated_ | Optional flag such as include\_terminated to include terminated roles | String | No |

#### Notes

-   Org/hierarchy semantics. Common pattern: col IN (GET\_TREE(...)).

### Example

```sql
SELECT
    GET_TREE(org_path, 'department', 'id', 1)
FROM
    rippling.employee.Employee
LIMIT
    5;
```

Source: https://developer.rippling.com/documentation/rippling-platform/transformations/sql-reference/get_tree

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
