linq to sql去掉重复
var list=from l in db.F0904
join p in db.F090401
on l.FailureClassNumber equals p.FailureClassNumber into temp
from t in temp.DefaultIfEmpty()
join c in db.F0901
on l.ElevatorNumber equals c.ElevatorNumber into temp1
from t1 in temp1.DefaultIfEmpty()
select new
{
}
------解决方案--------------------有distinct方法的啊
------解决方案--------------------1. 不要用匿名类
2. 使用Distinct的重载方法,重写IEqualityComparer接口
参考:
http://msdn.microsoft.com/en-us/library/bb338049.aspx
------解决方案--------------------重写比较
或者分组
group obj by new{字段1,字段2...} into g
select new {g.Key, g.First()}
------解决方案--------------------用这个方法
.Distinct().ToList()