How can I write the following SQL statement using QueryOver<> syntax?
SELECT COUNT(*) FROM (
SELECT FirstName,LastName
FROM People
GROUP BY FirstName, LastName
) as sub_t
I have the inner query working so far:
var q = _session.QueryOver<Person>()
.SelectList(l => l
.SelectGroup(x => x.FirstName)
.SelectGroup(x => x.LastName));
But I have no idea how to wrap this in a subquery and get a row count out of it. Can it be done?
Unfortunately my RDBMS dialect (MsSqlCe40Dialect) does not support COUNT DISTINCT so I do not have the benefit of using SelectCountDistinct().