0

我必须在 nhibernate 中编写下面的查询。

select count(*),Class from Student group by Class

请帮忙...

4

1 回答 1

0

可能是这样的吗?

ProjectionList projList = Projections.ProjectionList();
projList.Add(Projections.GroupProperty("Class"));
projList.Add(Projections.Count("Id"));
var result = session.CreateCriteria<Student>()
                            .SetProjection(projList)
                            .List();
于 2012-05-09T13:58:19.830 回答