How to generate "select count (*) as y from (select different x, y from tableName) as t" using NH?

Any ideas on how to generate the following query using Nhibernate using the Criteria API?

select count(*)as z from (select distinct x, y from tableName) as t

or

select count(distinct (x , y)) as z FROM tableName

or

some other query that returns the same results.

+3
source share
1 answer

You can try to generate such a request using the ICriteria API and Projection. You will need the Projections.RowCount(), Projections.Distinct(),Projections.Property()

+3
source

Source: https://habr.com/ru/post/1773731/


All Articles