Linq问题选择一列减去不同表中另一列的总和
这是我的 sql 代码,
SELECT M.PartNo AS ModulePartNo,
(SELECT SUM(Delivered - Allocated)
FROM V_InStock Stk
WHERE Stk.PartNo = M.PartNo) AS Available
FROM V_Products M
WHERE M.PartNo='100-25897'
我在使其在 Linq 中工作时遇到了真正的问题,无法计算出总和部分 - 任何帮助将不胜感激
This is my sql code
SELECT M.PartNo AS ModulePartNo,
(SELECT SUM(Delivered - Allocated)
FROM V_InStock Stk
WHERE Stk.PartNo = M.PartNo) AS Available
FROM V_Products M
WHERE M.PartNo='100-25897'
I am having real problems getting this to work in Linq, can't work out the sum part - any help would be really appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该有效。
This should work.
如果您需要进行聚合分组等,您可能需要设置一个对象来“选择”所有内容。然而,对于直接连接来说,这样的事情应该可行。
If you need to do aggregate grouping etc you will probably need to set up an object to "select" everything into. However for a straight join something like this should work.