如何获得工具表中持续的名称的收集c#linq
我有一个带有工具和工人的摘要表。因此,我无法处理的任务是如何在不涉及的摘要表中获取最后的工具计数。我想这就是这样,
var res = context.ToolsSummaryTable.Include(t => t.Tool).Include(t => t.Worker)
where(t.Tool.Name.Count() > t.Tool.Quantity);
请帮忙!
数据
工作人员 | 工具ID |
---|---|
1 | 2 |
2 | 3 |
3 | 2 |
1 | 2 |
工具表数据
名称 | 数量 |
---|---|
螺丝刀 | 2 |
悍马 | 3 |
扳手17 | 1 |
管子扳手 | 2 |
表数据
名称名称名称 | lastname |
---|---|
andrew | Greekman |
gordon | gordon |
摘要表 | gordon |
Wingman | 工人 |
I have a summary table with tools and workers. So task with i can't handle is how to get count of lasts tools in the summary table that are not involved. I guess it would be like this
var res = context.ToolsSummaryTable.Include(t => t.Tool).Include(t => t.Worker)
where(t.Tool.Name.Count() > t.Tool.Quantity);
Please Help!
Summary table Data
WorkerID | ToolID |
---|---|
1 | 2 |
2 | 3 |
3 | 2 |
1 | 2 |
Tools table data
Name | Quantity |
---|---|
Screwdriver | 2 |
Hummer | 3 |
Wrench 17 | 1 |
Pipe wrench | 2 |
Workers table data
FirstName | LastName |
---|---|
Andrew | Greekman |
Gordon | Wingman |
Sam | Peacekeeper |
Antony | Scout |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要一个左外连接。
左外连接是:“从G.Defaultifempty()的Tuusednone中”
请参阅下面的代码
You need a left outer join.
The left outer join is : "from tuUsedNone in g.DefaultIfEmpty()"
See code below