NHibernate QueryOver 与 SubQuery in where with or
我需要在 NHibernate 中使用 QueryOver 执行以下 SQL:
select *
from Post post
where post.User.Id = 1
or post.Level in (1, 2, 3)
or (select Id
from SubPost sub
where sub.Post = post
and sub.User.Id = 1) != null
我现在不知道如何使用 QueryOver 执行此操作。对我来说,问题是如何声明子查询以及如何使用 or
条件添加它。我希望,有人能给我提示。谢谢。
最好的问候,托马斯
I need to do the following SQL with QueryOver in NHibernate:
select *
from Post post
where post.User.Id = 1
or post.Level in (1, 2, 3)
or (select Id
from SubPost sub
where sub.Post = post
and sub.User.Id = 1) != null
I don't now how I can do this with QueryOver. The problem for me is how I have to declare the subquery and how can I add it with an or
condition. I hope, someone can give me a hint. Thank you.
Best Regards, Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个,
我不确定第二个在 JoinAlias 之后的位置,但试试吧
try this
i didn't sure really about the second where which is after the JoinAlias, but try it