v.25.10New Feature

Add LIMIT BY ALL syntax

Added LIMIT BY ALL syntax support. Similar to GROUP BY ALL and ORDER BY ALL, LIMIT BY ALL automatically expands to use all non-aggregate expressions from the SELECT clause as LIMIT BY keys. For example, SELECT id, name, count(*) FROM table GROUP BY id LIMIT 1 BY ALL is equivalent to SELECT id, name, count(*) FROM table GROUP BY id LIMIT 1 BY id, name. This feature simplifies queries when you want to limit by all selected non-aggregate columns without explicitly listing them. Closes #59152. #84079 (Surya Kant Ranjan).
Added support for the LIMIT BY ALL syntax, which automatically uses all non-aggregate expressions from the SELECT clause as keys for limiting results.

Why it matters

This feature simplifies queries by eliminating the need to explicitly specify all non-aggregate columns in the LIMIT BY clause. It reduces query verbosity and potential errors when limiting results by all selected non-aggregate columns.

How to use it

Use the syntax LIMIT n BY ALL in your query to limit the output by all non-aggregate expressions in the SELECT clause. For example:

SELECT id, name, count() FROM table GROUP BY id LIMIT 1 BY ALL

This is equivalent to:

SELECT id, name, count() FROM table GROUP BY id LIMIT 1 BY id, name