FiQueLa supports SQL-style grouping and aggregation. UseDocumentation Index
Fetch the complete documentation index at: https://docs.fiquela.io/llms.txt
Use this file to discover all available pages before exploring further.
groupBy() to collapse rows into groups, aggregate functions to compute group-level summaries, and having() to filter the aggregated results.
WHERE vs HAVING
The key distinction:WHERE— filters rows before grouping. Only rows that pass the filter are included in the groups.HAVING— filters groups after aggregation. Conditions can reference aggregate aliases.
groupBy()
Group rows by one or more fields. Dot notation is supported for nested fields:FiQueLa 3.0 — The same applies to aggregate helpers —
groupBy() accepts any SQL expression, including function calls and infix arithmetic. The expression is evaluated for each row and the result is used as the grouping key.sum(), avg(), min(), max(), and groupConcat() accept full expressions:DISTINCT and GROUP BY cannot be used together. Attempting to combine them throws a QueryLogicException.Aggregate functions
| Fluent method | FQL function | Description |
|---|---|---|
count($field, $distinct) | COUNT(field) / COUNT(DISTINCT field) | Count rows |
sum($field, $distinct) | SUM(field) / SUM(DISTINCT field) | Sum of values |
avg($field) | AVG(field) | Average value |
min($field, $distinct) | MIN(field) / MIN(DISTINCT field) | Minimum value |
max($field, $distinct) | MAX(field) / MAX(DISTINCT field) | Maximum value |
groupConcat($field, $sep, $distinct) | GROUP_CONCAT(field, sep) / GROUP_CONCAT(DISTINCT field, sep) | Concatenate values |
bool $distinct parameter (except avg()). groupConcat() also accepts a separator string.
Examples
DISTINCT in aggregates
Passtrue as the last argument to count, sum, min, max, or groupConcat only unique values: