---
schema_version: "1"
id: 87f292ba427f00974f7e12951af97da2bfaf395c1f80277d43f86f8e7752d632
title: limit
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-statement-limit.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-statement-limit.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 59a4755746c4aa8e2ab016e994576cb1f6a8eff1be78d1c088a0c89ee280a3f5
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# limit

Limits the number of results that are returned. If you don’t set a limit, queries return a maximum of 10,000 rows.

## Syntax

```nolang
result = limit rows number;
```

## Usage

Use this statement only on data that has been ordered with the `order` statement. The results of a `limit` operation aren’t automatically ordered, and their order can change each time that statement is called.

You can use the `limit` statement with ungrouped data.

You can use the `limit` statement to limit grouped data by an aggregated value. For example, to find the top 10 regions by revenue: group by region, call `sum(revenue)` to aggregate the data, `order` by `sum(revenue)` in descending order, and `limit` the number of results to the first 10.

**note:** The `limit` statement isn’t a `top()` or `sample()` function.

## Example

This example limits the number of returned results to 10:

```nolang
b = limit a 10;
```

The expression can’t contain any columns from the input. For example, this query is not valid:

```nolang
b = limit OrderDate 10;
```

**See Also**

- [Statements](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-statements.md)
- [order](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-statement-order.md)
