请您分享我通过JPA编写的代码片段,以便生成以下的SQL查询
> chipsArray = [{'cheetos':'good'},{'dorritos':'better'}]
[ { cheetos: 'good' }, { dorritos: 'better' } ]
> Object.values(chipsArray[0])
[ 'good' ]
因为我试过以下方式。但MaxResults似乎没有被应用,因为我能够收到超过10的计数。
SELECT COUNT(*) FROM Customer c
WHERE c.countryId ='Canada' AND
c.lanuguage ='ENG' AND
ROW_NUM <=10;
答案 0 :(得分:0)
选择计数将始终返回单个值。如果您希望计数低于10,请添加HAVING。
SELECT COUNT(c) AS
FROM Customer c
WHERE c.countryId='Canada' and c.language='END'
HAVING COUNT(c)<=10