8,497
社区成员
发帖
与我相关
我的任务
分享
var result = from p in this.context.故障记录表
let temp1 = (from p in this.context.故障处理表
select new { p.故障编号, p.处理标志 }).Distinct()
let temp2 = from p in this.context.故障处理表
join o in temp1
on new { p.故障编号, p.处理标志 } equals new { o.故障编号, o.处理标志 }
select new { p.故障编号, p.处理标志, p.处理时间 }
let temp3 = from p in temp2
group p by new { p.故障编号, p.处理标志 } into g
select new { g.Key.故障编号, g.Key.处理标志, 最后处理时间 = g.Max(p => p.处理时间) }
join o1 in this.context.网点信息表 on p.网点号 equals o1.网点号 into gj1
from g1 in gj1.DefaultIfEmpty()
join o2 in this.context.用户信息表 on g1.登记人 equals o2.登录ID into gj2
from g2 in gj2.DefaultIfEmpty()
join o3 in this.context.终端信息表 on g2.标签号 equals o3.标签号 into gj3
from g3 in gj3.DefaultIfEmpty()
join o4 in temp3 on new {g3.序号, g3.处理标志} equals new {o4.故障编号, o4.处理标志} into gj4
from g4 in gj4.DefaultIfEmpty()
select new
{
p.序号,
p.分类,
p.标签号,
p.故障分类,
p.故障描述,
p.登记时间,
p.处理标志,
g1.隶属支行,
网点 = g1.网点名,
登记人 = g2.用户名
};