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
{{ message }}
Repository navigation
Incorrect result when grouping by two columns with the same name with or without joins #941
The results to this query are just incorrect. One of the projected expressions ends up not being there and the other has the values intended for the missing one. Works in any situation where the column names are the same regardless of what else you do.
var accounts = [
{ name: 'A', region_id: 1 },
{ name: 'B', region_id: 2 }
];
var regions = [
{ id: 1, name: 'North' },
{ id: 2, name: 'South' }
];
// Do the query
var result = alasql("SELECT accounts.name AS `AccountName`, regions.name AS `RegionName`, COUNT(1) AS `Count` FROM ? accounts LEFT JOIN ? regions ON accounts.region_id = regions.id GROUP BY accounts.name, regions.name", [accounts, regions]);
document.getElementById("result").innerHTML = JSON.stringify(result);
// An even simpler example
var result2 = alasql("SELECT accounts.name AS `AccountName`, accounts.name AS `AccountName2`, COUNT(1) AS `Count` FROM ? accounts GROUP BY accounts.name", [accounts]);
document.getElementById("result2").innerHTML = JSON.stringify(result2);
Activity
mathiasrw commentedon Dec 2, 2025
Fix GROUP BY with duplicate column names issue
Correct grouping across columns with same name to fix #941 (#2307)
mathiasrw commentedon Dec 6, 2025
Fix released as part of v4.11.0