- Notifications
You must be signed in to change notification settings - Fork689
Array
Mathias Rangel Wulff edited this pageMar 3, 2017 ·6 revisions
ARRAY() Aggregator
This aggregator is used to aggregate all values into the array.
Syntax:
ARRAY([DISTINCT] expression)varres=alasql('SELECT userId, FIRST(userName) AS userName, \ ARRAY({category:category,[count]:[count]}) AS purchases, \ SUM([count]) AS totalCount FROM ? GROUP BY userId, userName',[data]);
See exampleat jsFiddle. For a real world example check outhttps://github.com/agershun/alasql/issues/827#issuecomment-283756454 .
The keyword can also be used like in this example
SELECT COLUMN a FROM test1 WHERE a = ANY (ARRAY[2,3,4])© 2014-2026,Andrey Gershun &Mathias Rangel Wulff
Please help improve the documentation by opening a PR on thewiki repo