时间:2019-03-17 标签:c#Lambda子查询(linq2sql)
是否可以在 Lambda 中编写与此 TSQL 语句等效的语句?
SELECT DISTINCT pba1.adGroupsId , Amount = (SELECT pba2.value FROM ProjectBudgetAdjustment pba2 WHERE pba1.budgetId = pba2.budgetId AND pba1.adGroupsId = pba2.adGroupsId AND pba2.metricId IN ( SELECT id FROM Metrics WHERE [description] = 'Amount') ) , [Hours] = (SELECT pba2.value FROM ProjectBudgetAdjustment pba2 WHERE pba1.budgetId = pba2.budgetId AND pba1.adGroupsId = pba2.adGroupsId AND pba2.metricId IN ( SELECT id FROM Metrics WHERE [description] = 'Hours') ) FROM ProjectBudgetAdjustment pba1 WHERE pba1.budgetId IN ( SELECT id FROM ProjectBudget WHERE projectId IN ( SELECT id FROM Projects WHERE code = 'xxx' ) )
Is it possible to write the equivalent of this TSQL statement in Lambda?
SELECT DISTINCT pba1.adGroupsId , Amount = (SELECT pba2.value FROM ProjectBudgetAdjustment pba2 WHERE pba1.budgetId = pba2.budgetId AND pba1.adGroupsId = pba2.adGroupsId AND pba2.metricId IN ( SELECT id FROM Metrics WHERE [description] = 'Amount') ) , [Hours] = (SELECT pba2.value FROM ProjectBudgetAdjustment pba2 WHERE pba1.budgetId = pba2.budgetId AND pba1.adGroupsId = pba2.adGroupsId AND pba2.metricId IN ( SELECT id FROM Metrics WHERE [description] = 'Hours') ) FROM ProjectBudgetAdjustment pba1 WHERE pba1.budgetId IN ( SELECT id FROM ProjectBudget WHERE projectId IN ( SELECT id FROM Projects WHERE code = 'xxx' ) )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在这里可能完全错了,但它是这样的吗:
I could be total wrong here, but is it something like :