我对林克来说是相当新奇的,我需要加入两张表格,其要求如下:
左侧应连接 t1 和 t2。
如果 t2 是空的, 那么查询不应该失败 - 应该使用默认值 。
我的查询:
var final = from t1 in saDist.AsEnumerable()
from t2 in sapGrouped.AsEnumerable()
where
t1.Supplier.Id == t2.Supplier.Id && t1.VatRate == t2.VatRate
select
new
{
t1.Supplier,
Amount = t1.Amount - t2.Amount,
Advance = t1.Advance - t2.Advance,
Balance = t1.Balance - t2.Balance,
t1.VatRate
};
有人能纠正这个吗?