2012-11-07 36 views
-1

请帮我试试并转换此连接查询。我试图将以下SQL查询转换为LINQ查询,但无法使其工作。任何人都可以帮我解决这个问题吗?无法将SQL查询转换为Linq

SELECT T1.BoCode, case when T2.qty is null then 0 else T2.qty end 
FROM 
    (SELECT bocode from TABLE1) as T1 
left join 
    (SELECT cBoCode, sum(qty) as qty FROM TABLE2 where ncampnurn in 
     (select nurn FROM TABLE3 INNER JOIN TABLE4 ON TABLE3.CampaignCode = 
     TABLE4.CampaignCode 
     where TABLE3.Month = 'Sep12' and TABLE4.ReportGroup = 'testgroup') 
    GROUP BY cBoCode) as T2 
ON T1.BoCode = T2.cBoCode 
order by T1.BoCode 

我只能够做的中间位,然后卡住我是否需要使用ContainsAny

from t3 in table3 
join t4 in table4 on t3.CampaignCode equals t4.CampaignCode 
where t3.Month == "Sep12" && t4.ReportGroup == "testgroup" 
select t3.Nurn 

回答