Skip to main content

LIMIT

Use LIMIT to cap the number of rows a query returns, and add OFFSET to skip rows before the limit applies. Because result order isn't guaranteed without sorting, pair LIMIT with ORDER BY to return a stable set of rows.

Syntax

LIMIT count [OFFSET count]

Anchor to Row limit and offsetRow limit and offset

Set the maximum number of rows the query returns. Add OFFSET to skip a number of rows first, which pages through results in fixed-size pages. Pair LIMIT with ORDER BY so the rows you keep are deterministic.

Anchor to LIMIT
LIMIT
LIMIT <count>

Returns at most the specified number of rows.

Anchor to OFFSET
OFFSET
LIMIT <count> OFFSET <count>

Skips rows before returning the limited result set.

Examples

ShopifyQL

FROM sales
SHOW total_sales
GROUP BY product_title
SINCE -30d UNTIL today
ORDER BY total_sales DESC
LIMIT 10

Was this page helpful?