开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜