The SQL query created when using a GROUP BY with a
WHERE clause was invalid, the GROUP BY was before
the WHERE clause. This resulted in alasql failing
to parse the query.
Fixed to separate adding the GROUP BY fields in the
SELECT clause, and adding the actual GROUP BY clause
later after the WHERE clause.
Added unit test to cover the changes.
Before the change, the generate SQL query looked like
this:
SELECT AVG(properties->Trunk_Diameter) as avg_Trunk_Diameter,
properties->Genus as Genus
FROM ?
GROUP BY properties->Genus
WHERE properties->Trunk_Diameter > 10
After it looks like this:
SELECT AVG(properties->Trunk_Diameter) as avg_Trunk_Diameter,
properties->Genus as Genus
FROM ?
WHERE properties->Trunk_Diameter > 10
GROUP BY properties->Genus
The SQL query created when using a GROUP BY with a WHERE clause was invalid, the GROUP BY was before the WHERE clause. This resulted in alasql failing to parse the query.
Fixed to separate adding the GROUP BY fields in the SELECT clause, and adding the actual GROUP BY clause later after the WHERE clause.
Added unit test to cover the changes.
Before the change, the generate SQL query looked like this:
SELECT AVG(properties->
Trunk_Diameter
) asavg_Trunk_Diameter
, properties->Genus
asGenus
FROM ? GROUP BY properties->Genus
WHERE properties->Trunk_Diameter
> 10After it looks like this:
SELECT AVG(properties->
Trunk_Diameter
) asavg_Trunk_Diameter
, properties->Genus
asGenus
FROM ? WHERE properties->Trunk_Diameter
> 10 GROUP BY properties->Genus