I want to write such a query with QueryOver so that the result SQL will be similar to the following:
Select Bar, count(*) from Foo group by Bar having count(*) > 1
How can I do it ?
I think you would just use the Where method
Session.QueryOver<Foo>()
.Select(Projections.GroupProperty(Projections.Property<Foo>(foo => foo.Bar)),
Projections.Count<Foo>(f => f.Id))
.Where(Restrictions.Gt(Projections.Count<Foo>(f => f.Id), 1));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With