我有一个 HQL 查询:
select max(l.Num) from SomeTable l group by l.Type, l.Iteration
如何将其翻译/转换为 QueryOver?
下一个:
var grouped = session.QueryOver<SomeTable>()
.SelectList(l => l
.SelectGroup(x => x.Type)
.SelectGroup(x => x.Iteration)
.SelectMax(x => x.Num));
将生成 SQL:
SELECT
MAX(l.Num),
l.Type,
l.Iteration
FROM
SomeTable l
GROUP BY
l.Type,
l.Iteration
这不是我所期望的——我不想在 Select 中有 Type 和 Iteration。
我将该查询用作select z from c where z IN (subquery)
.