您好我正在尝试从数据库部门实现查询(其中包含案例语句),但我无法弄清楚问题所在。
@Query("select new com.withgratitude.api.core.domain.ReportTopTenBiddersTable( CONCAT(u.firstName, ' ', u.lastName), " +
"b.auctionId, b.date), " +
" case when (b.isTheWinner = 0) then 'No' when (b.isTheWinner = 1) then 'Yes' else 'No Winner' end as winnerBid" +
" from Bids b, Users u " +
" where b.userId = u.userId " +
" order by CONCAT(u.firstName, ' ', u.lastName)")
List<ReportTopTenBiddersTable> reportTopTenBiddersTable();
Here is the Query I am trying to implement:
#top 10 bidders - table
select CONCAT(u.first_name, ' ', u.last_name) as name, b.auction_id, b.date,
case b.is_thewinner when 0 then 'No' when 1 then 'Yes' end as WinnerBid, b.offer
from bids b, users u
where b.user_id = u.user_id
order by name
limit 10;
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: , near line 1, column 130 [select new com.withgratitude.api.core.domain.ReportTopTenBiddersTable( CONCAT(u.firstName, ' ', u.lastName), b.auctionId, b.date), case when b.isTheWinner = 0 then 'No' when b.isTheWinner = 1 then 'Yes' else 'No Winner' end as winnerBid from com.withgratitude.api.core.dao.Bids b, com.withgratitude.api.core.dao.Users u where b.userId = u.userId order by CONCAT(u.firstName, ' ', u.lastName)]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.hql.internal.ast.ErrorTracker.throwQueryException(ErrorTracker.java:93) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:296) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
ITMISS
LEATH
相关分类