admin管理员组文章数量:1405864
I'm trying to make a join table by preprocessing its columns using aggregating functions, but if I do something like
fromQuerayble
.SelectMany(fromElement => joinQueryable.Where(joinElement => fromElement.Id == joinElement.FromId).Select(joinElement => new { fromElement, joinedId = joinElement.Id.MySomeDbFunction()}))
.ToList()
then I get a
SELECT request..(fromQueryable elements), my_some_db_function(joined_table_id)
FROM from_table
CROSS JOIN joined_table
WHERE from_table.id = joined_table.from_table_id`
, that is, using the function, The one I want to use in the join subquery is placed at the top level, which is why the query crashes because no aggregating functions have been applied to the rest of the columns.
I expect that nhibernate return something like
SELECT ..(from columns), joined_table.id
FROM from_table
CROSS JOIN (select my_some_db_function(joined_table.id) id from joined_table) joined_table
WHERE joined_table.from_table_id = from_table.id
Actually for some context, I need it for using lateral join with array_agg + unnest functions on columns inside the subquery
本文标签: cIs there any way to get a join of a subquery in NHibernate LINQStack Overflow
版权声明:本文标题:c# - Is there any way to get a join of a subquery in NHibernate LINQ? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744958582a2634509.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论