diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 58a987dc89..8d07e71682 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -667,7 +667,7 @@ class BaseModelSqlv2 { // if sort is provided filter out the group by columns sort and apply // since we are grouping by the column and applying sort on any other column is not required - for (const sort of sorts) { + for (const sort of sorts || []) { if (!groupByColumns[sort.fk_column_id]) { continue; }