Is it possible to group by a property without selecting the property?

var subquery = DetachedCriteria.For<Teacher>("teacher")
.CreateCriteria("Pupil", "pupil")
.SetProjection(
Projections.ProjectionList()
.Add(Projections.GroupProperty("pupil.Id"))
.Add(Property.ForName("teacher.Id").Max().As("maxId")));

this produces a select query like this:

select p.Id, max(t.Id) from teacher t
inner join pupil p on p.teacherId = t.Id
group by p


but I need a query like this

select max(t.Id) from teacher t
inner join pupil p on p.teacherId = t.Id
group by p

because I want use the result in another query.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to