问题描述:

I have the following object below which is a breeze.js entity. I am trying to do a basic group by function. In this case it is throwing an error. Is the issue is that Breeze entities are not supported? Basic select statements are working fine on this object!

Object-

count:1

description:"1 sweepstake ticket"

displayName:"1 sweepstake ticket"

payload:"1"

rewardId:14

type:3

var res = alasql('SELECT type, SUM(count) AS b FROM ? group by type', [data]);

console.log(res);

Getting this error:

{message: "Parse error on line 1:↵...LECT type, SUM(count) AS…-------------------^↵Expecting 'LPAR', got 'RPAR'", hash: Object}hash: Objectexpected: Array[1]0: "'LPAR'"length: 1__proto__: Array[0]line: 0loc: Objecttext: ")"token: "RPAR"proto: Objectmessage: "Parse error on line 1:↵...LECT type, SUM(count) AS b FROM ? group ↵-----------------------^↵Expecting 'LPAR', got 'RPAR'"proto: Error()(anonymous function) @ angular.js:11655(anonymous function) @ angular.js:8596(anonymous function) @ angular.js:13256$eval @ angular.js:14466$digest @ angular.js:14282(anonymous function) @ angular.js:14505e @ angular.js:4924(anonymous function) @ angular.js:5312

8notificationService.js:84 poller callback

Thanks

网友答案:

Resolved on the github site.

Here count is a AlaSQL's keyword, so can you rewrite the query with enclosed [count] or backquotes count:

var res = alasql('SELECT type, SUM([count]) AS b FROM ? GROUP BY type', [data]);

https://github.com/agershun/alasql/issues/733

相关阅读:
Top