我正在使用以下DetachedCriteria:
DetachedCriteria subCr = DetachedCriteria.For<Packages>();
subCr.SetProjection(Projections.ProjectionList().Add(Projections.Max("ID")).Add(Projections.GroupProperty("Hotel.ID")));
cr.Add(Subqueries.PropertyIn("ID", subCr1));
cr是另一个查询,但我的问题是关于subCr。 DetachedCriteria转换为以下查询:
SELECT max(this_0_.ID) as y0_,
this_0_.HOTEL_ID as y1_
FROM CACHE_PACKAGES this_0_
GROUP BY this_0_.HOTEL_ID
问题是我不会将属性HOTEL_ID放在select中(只有表达式max(this_0_.ID))
那么如何从select中删除属性但仍在使用group by?