Skip to content

JOINs only return the second subquery #1789

@gygabyte017

Description

@gygabyte017

Consider this simple query:

alasql(`	
	SELECT 
		a.outcome, 
		a.n, a.n/b.n as p 
	FROM (
		SELECT 	
			result as outcome, 
			COUNT(*) AS n 
		FROM ? 
		GROUP BY result
	) a 
	CROSS JOIN (
		SELECT COUNT(*) as n FROM ?
	) b
`, [x, x])

It returns this kind of object: [{n: 123}], so it seems to be returing just the result of the subquery SELECT COUNT(*) as n FROM ? instead of the whole query, how is that possible?

It consistently happens as well with other types of JOINs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions