2

我写了查询,我想将其转换为 linq 查询

SELECT     dbo.tblSaman.fldSamanId, dbo.tblFaaliatSaman.FldFaaliatId
FROM         dbo.tblSaman LEFT OUTER JOIN
                  dbo.tblFaaliatSaman ON dbo.tblSaman.fldSamanId = dbo.tblFaaliatSaman.fldSamanId
WHERE     (dbo.tblFaaliatSaman.FldFaaliatId IN (3, 4))
4

1 回答 1

0

尝试使用类似的东西:

int[] ids = { 3, 4 };
            var items = context.tblSaman.Join(context.tblFaaliatSaman.DefaultIfEmpty().Where(x => ids.Contains(x.FldFaaliatId)), x => x.fldSamanId,
                                  y => y.fldSamanId, (x, y) => new { fldSamanId = x.fldSamanId, FldFaaliatId = y.FldFaaliatId });
于 2012-10-24T08:41:08.943 回答