Skip to content

A column that is neither grouped nor aggregated reads undefined in an expression, HAVING or ORDER BY of a grouped query #3150

Backlog

Description

@mathiasrw
const data = [{g: 1, b: 5}, {g: 1, b: 6}, {g: 2, b: 7}];
alasql('SELECT g, b FROM ? GROUP BY g', [data]);
alasql('SELECT g, b + 1 AS c FROM ? GROUP BY g', [data]);
alasql('SELECT g FROM ? GROUP BY g HAVING b > 6', [data]);
alasql('SELECT g FROM ? GROUP BY g ORDER BY b DESC', [data]);

The bare b reads the first row of each group, but c is missing, HAVING finds no rows and ORDER BY does not sort.

They should read the same row as the bare b, which gives c 6 and 8, the group 2 for HAVING and 2, 1 for ORDER BY, as SQLite does.

Fixed by #2647.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions