2010-03-19 32 views
1

我想返回整個實體以及一些聚合列。在SQL我會使用內部選擇,如下所示:NHibernate:選擇整個實體加聚合列

SELECT TOP 10 f.*, inner_query.[average xxx] 
FROM (
     SELECT f.Id, AVG(fb.xxx) AS [average xxx] 
     FROM foobar fb 
     INNER JOIN foo f ON f.FoobarId = fb.Id 
    ) AS inner_query 
INNER JOIN foo f ON f.Id = inner_query.Id 

這是可能的CreateCriteria?

回答