Skip to content

Creating a view with subquery does not work #1154

Closed

Description

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)

Activity

  1. 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
  2. added a commit that references this issue on Dec 22, 2025
    86e8e46
  3. mathiasrw commented on Dec 23, 2025

    @mathiasrw
    Member

    Fix released as part of v4.16.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions