Closed citruspress closed 11 months ago
I shortly looked into this issue, and the reason that this fails is due the these lines in 38query
(which were added in https://github.com/AlaSQL/alasql/issues/1797):
for (const key in query.groupColumns) {
if (query.groupColumns[key] !== key && d[query.groupColumns[key]])
delete d[query.groupColumns[key]];
}
Although i don't have a fix, the workaround would be to not use aliases in queries that map to columns used in the same SELECT.
I have added a fix here: https://github.com/AlaSQL/alasql/pull/1835
Released as part of v4.2.2
With a SELECT query like the following:
I get the following results using
4.1.9
(https://jsfiddle.net/02c9esvw/37/):And the following with
4.1.10
(https://jsfiddle.net/kqjtoapz/99/):The same goes when selecting MATRIX like this:
[0] AS [1], [1] AS [2]
which is what we're actually using in some cases.I would expect the 4.1.9 result is correct. If it's not is this an intentional change that we should adapt to?