Skip to content

Nested SubQueries do not work as expected #1924

Open
@bc-saranya

Description

@bc-saranya

Description -
Nested subqueries leads to an error TypeError: Cannot read properties of undefined (reading '0')

I have created three tables like below:

alasql("CREATE TABLE cities (city string, population number)");
alasql("INSERT INTO cities VALUES ('Rome',2863223), ('Paris',2249975), ('Berlin',3517424),  ('Madrid',3041579),('Easingwold',4627)");

alasql("CREATE TABLE countries (name string, population number, city string)");
alasql("INSERT INTO countries VALUES ('Italy', 89764679009, 'Rome'), ('France', 165247191, 'Paris'), ('Germany', 346186257, 'Berlin')");

alasql("CREATE TABLE population (number int)");
alasql("INSERT INTO population VALUES (89764679009), (165247191)");

I use a SELECT query with nested subqueries, e.g -

SELECT * FROM cities WHERE city IN (SELECT DISTINCT city FROM countries WHERE population IN (SELECT DISTINCT number from population))

Expected output - Rome, Paris

Actual Output - TypeError: Cannot read properties of undefined (reading '0')

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions