0

几天来,我一直在尝试在 LINQ 中“翻译”这个查询,但到目前为止没有成功。你们能帮帮我吗?我也很感激一些解释,以从中学到一些实际的东西。

这是 T-SQL 查询:

SELECT R.ResourceID, R.DefaultValue
FROM Resources as R
JOIN
    (SELECT [t0].[NameResourceID] AS [ResourceID]
    FROM [dbo].[Sectors] AS [t0]
    LEFT OUTER JOIN [dbo].[LocalizedResources] AS [t1] ON [t0].[NameResourceID] = [t1].[ResourceID] and [t1].[LanguageID] = 2
    WHERE t1.Value IS NULL)  AS subQ 

ON R.ResourceID = subQ.ResourceID

谢谢

4

1 回答 1

0

尝试这样的事情:

from r in db.Resources
join subQ in (from t0 in db.Sectors
              join t1 in db.LocalizedResources on t0.NameResourceID equals t1.ResourceID
              where t1.LanguageId
              && t1.Value == null
              select new { ResourceID = t0.NameResourceID }) on r.ResourceID equals subQ.ResourceID
select new { r.ResourceId, r.DefaultValue };
于 2009-08-04T11:31:12.750 回答