Having a query like the following:
var subquery = SessionFactory.GetCurrentSession()
.QueryOver<SomeEntity>()
.Where(_ => _.SomeOtherEntity.Id == someId)
.SelectList(list => list
.SelectGroup(x => x.SomeGroupByProperty)
.SelectMax(x => x.MaxPerGroupProperty))
.List<dynamic>();
The generated sql is selecting both SomeGroupByProperty
and maximum of MaxPerGroupProperty
. Is it possible to get it to group on SomeGroupByProperty
but only select maximum of MaxPerGroupProperty
? This is for using the subquery result with a contains in parent query.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…