views:

98

answers:

0
+2  Q: 

NHibernate Query

Is it possible to get NHibernate to generate a query similar to the following with HQL or Criteria API?

select
    *
from (
    select
       row_number() over ( partition by Column1 order by Column2 ) as RowNumber,
       T.*
    from
        MyTable T
)
where
    RowNumber = 1

I can get it to execute the inner select using the formula attribute, but I can't figure out a way to write a HQL or Criteria query that lets me wrap the inner select in the outer one.