-1

请帮助我尝试转换此联接查询。我正在尝试将以下 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 
4

1 回答 1

0

参考这个

SQL 到 LINQ 工具

或者自己做

http://www.linqpad.net/

于 2012-11-07T09:11:57.690 回答