开发者

NHibernate: Select entire entity plus aggregate columns

开发者 https://www.devze.com 2022-12-24 12:11 出处:网络
I want to return an entire entity, along with some aggregate columns. In SQL I would use an inner select, something like this:

I want to return an entire entity, along with some aggregate columns. In SQL I would use an inner select, something like this:

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 开发者_StackOverflow中文版ON f.FoobarId = fb.Id
     ) AS inner_query
INNER JOIN foo f ON f.Id = inner_query.Id

Is this possible with CreateCriteria?


You could add a formula property to the entity: see #5 on this list.

0

精彩评论

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

关注公众号