I would like to work on a table grouped by users to rank by studytime sum.
- The table saved based on the sum of studytime is not in the original db and is created with the code below.
List<RankingRankGetRes> userRankInfo = jpaQueryFactory.select(new QRankingRankGetRes(qStudyTime.user.nickname, qStudyTime.user.department.name, qStudyTime.time.sum())).from(qStudyTime)
.groupBy(qStudyTime.user).orderBy(qStudyTime.time.sum().desc()).fetch();
- How to use this to create a query that returns a ranking based on studytime?
The rank() function is not provided in JPAQueryFactory. Is there a way to do that query without this?
Is there a way to do it using SQLExpressions?