var item= (from t1 in _dbEntities.PurchaseSales
join t2 in _dbEntities.ItemTypes on t1.ItemTypeID equals t2.ID
where t2.ID.Equals(null)
select t2).ToList();
怎么做左连接呢
答案 0 :(得分:0)
使用DefaultIfEmpty
:
var item= (from t1 in _dbEntities.PurchaseSales
join t2 in _dbEntities.ItemTypes on t1.ItemTypeID equals t2.ID into t
from l in t.DefaultIfEmpty()
where l == null
select t1).ToList();