You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following query list throws an error in alasql, but works in sqlite:
const alasql = require('alasql')
var db = new alasql.Database()
db.exec('create table sub_table(id int)')
db.exec('create table from_table(id int)')
db.exec('create view new_view as select (select count(id) from sub_table) as amount from from_table')
// Error: Table does not exist: sub_table
Basically one should be able to create a view by using a valid query and the used query is valid:
const alasql = require('alasql')
var db = new alasql.Database()
db.exec('create table sub_table(id int)')
db.exec('create table from_table(id int)')
var result = db.exec('select (select count(id) from sub_table) as amount from from_table')
console.log(result)
Reacted by Copilot
Activity
ghost changed the title [-]create view with subquery does not work as expected[/-][+]Creating a view with subquery does not work[/+]on Jan 17, 2020
Activity
[-]create view with subquery does not work as expected[/-][+]Creating a view with subquery does not work[/+]Fix subqueries for CREATE VIEW to close AlaSQL#1154 (AlaSQL#2406)
mathiasrw commentedon Dec 23, 2025
Fix released as part of v4.16.0