1
select T.Id, count(Th.ampount)
from TH, T
where Th.Tid= T.id
group by T.Id

流暢なnhibernateを使用して上記のクエリを作成する方法。CreateSQLQuery()を使用したくありません。

4

1 に答える 1

-1
session.QueryOver<TH>()
    .JoinAlias(th => th.Ts, () => tAlias)
    .SelectList(list => list
        .SelectGroup(th => th.Id)
        .SelectCount(() => tAlias.amount)
        // or did you mean
        .SelectSum(() => tAlias.amount)
    )
    .List<object[]>();
于 2012-05-14T13:04:21.873 に答える