开发者

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

开发者 https://www.devze.com 2023-01-24 06:09 出处:网络
Any ideas 开发者_C百科on how to generate the follow query with Nhibernate using the Criteria API?

Any ideas 开发者_C百科on how to generate the follow query with 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.


You can try to generate such a query with the help of ICriteria API and Projection. What you are going to need are Projections.RowCount(), Projections.Distinct(), Projections.Property()

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号