Using HQL with MySQL how can I order the result set before the group by so the right record is picked?

前端 未结 1 1913
不思量自难忘°
不思量自难忘° 2021-01-27 02:21

Is there any way to write a greatest-n-per-group query in HQL (or potentially with Hibernate Criteria) in a single query?

I\'m struggling with a problem that\'s similar

相关标签:
1条回答
  • 2021-01-27 03:08

    For that, you need a SQL window function. There is no way to do it in Hibernate/HQL, HQL doesn't support window functions.

    greatest-n-per-group tag has the correct answers. For instance, this approach is pretty readable, though not always optimal.

    0 讨论(0)
提交回复
热议问题