Skip to content
agershun edited this page Dec 22, 2014 · 6 revisions

ARRAY() Aggregator

    var res = 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 example at jsFiddle

Clone this wiki locally