Skip to content

ORDER BY after a parenthesised part with its own LIMIT sorts only the rows of the first part #3134

Backlog

Description

@mathiasrw
alasql('CREATE TABLE A (a INT); INSERT INTO A VALUES (3),(1),(2)');
alasql('CREATE TABLE B (a INT); INSERT INTO B VALUES (9),(8),(7)');
alasql('SELECT COLUMN a FROM A UNION ALL (SELECT a FROM B ORDER BY a LIMIT 2) ORDER BY a DESC');

It gives [3, 2, 1, 7, 8].

SQLite gives 8, 7, 3, 2, 1 (with the part written as SELECT * FROM (...)).

Fixed by #2712.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions