-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested SubQueries do not work as expected #1924
Comments
alasql("CREATE TABLE cities (city string, population number)"); 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)"); SELECT * FROM cities WHERE city IN (SELECT DISTINCT city FROM countries WHERE population IN (SELECT DISTINCT number from population)) |
@SuvitsonHarrese https://github.com/AlaSQL/alasql#traditional-sql-table does show number as possible column value though. @bc-saranya we can check this out. It would be nice if the parser would throw an error on unknown data types though. Somewhere here probably Line 16 in ca7ecb4
|
@SuvitsonHarrese I tried by changing the data type to int, but still the same error occurs. |
yeah now i checked again I got the exact same error |
@paulrutter i think the problem is with the nesting in subqueries that means a query can have one subquery and no subquery within subquery of main query
|
hi, I was wondering if this issue got resolved. If not, can I pick it up? |
It's not resolved as far as i know, so you can work on it for sure. @choia4 |
Verify Subqueries Individually:
Ensure this subquery returns expected city values. Subquery 2:
Ensure this subquery returns the correct numbers. Execute the Main Query: With verified subqueries, combine them into the main query:
|
Description -
Nested subqueries leads to an error
TypeError: Cannot read properties of undefined (reading '0')
I have created three tables like below:
I use a SELECT query with nested subqueries, e.g -
Expected output - Rome, Paris
Actual Output -
TypeError: Cannot read properties of undefined (reading '0')
The text was updated successfully, but these errors were encountered: