Skip to content

ORDER BY sorts the rows; LIMIT keeps the first ones, and OFFSET skips some before that.

FROM deals
SHOW won_value
GROUP BY owner
ORDER BY won_value DESC
LIMIT 5
ORDER BY <metric | field | alias> [ASC | DESC][, ...]

Sort by anything you SHOW or GROUP BY, by an AS name, or by a function you show (ORDER BY sum(amount) DESC). ASC is the default. Later columns break ties:

ORDER BY stage ASC, value DESC
LIMIT <n> [OFFSET <n>]

LIMIT 10 OFFSET 10 shows rows 11 to 20. A report returns at most 1,000 rows.

In a cohort report, LIMIT sets how many periods each cohort follows.

For “top 5 owners”, either sort and limit, or use TOP to keep the rest as an Other row:

GROUP BY TOP 5 owner