How can I count the number of result groups in QueryDSL?
问题 How can I implement a count-of-groups in QueryDSL (in Java)? Background I'm implementing a paged search on a table, where I want to group the results before returning them. In addition to the usual LIMIT x OFFSET y query, I also want to receive the total row count. This is the (simplified) SQL query for one page: SELECT x, y, MAX(z) FROM tasks WHERE y > 10 GROUP BY x, y LIMIT 10 OFFSET 0 To retrieve the number of rows, I tried to use a naive COUNT(*) instead of the x, y, MAX(z) like this: