当我执行此代码时(JPA)
Query q=entityManager.createQuery(SELECT mc.account_no,mc.expiry_date,
SUM(CAST(CONCAT(mc.sign,mc.balance) AS NUMBER)),mc.moneybank_id FROM muthutcardbalance mc
WHERE mc.account_no='20' AND mc.scheme_code='MCB' AND mc.expiry_date >= '2015-07-28'
GROUP BY mc.expiry_date,mc.account_no ,mc.moneybank_id ORDER BY mc.expiry_date )
我收到以下错误。我对此感到震惊。
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT mc.account_no,mc.expiry_date,SUM(CAST(CONCAT(mc.sign,mc.balance) AS NUMBER)),mc.moneybank_id FROM muthutcardbalance mc WHERE mc.account_no='20' AND mc.scheme_code='MCB' AND mc.expiry_date >= '2015-07-28' GROUP BY mc.expiry_date,mc.account_no ,mc.moneybank_id ORDER BY mc.expiry_date ], line 1, column 49: unexpected token [(].
我将 JPA 2 与 EclipseLink 2.0 一起使用。
我的查询有什么问题?
但是当删除这个 SUM(CAST(CONCAT(mc.sign,mc.balance) AS NUMBER)) 它工作正常