Linq to SQL相当于这个查询

时间:2012-03-05 19:51:43

标签: sql vb.net linq-to-sql

这是我正在尝试重现的查询:

select
    act.AccountID,
    ast.AssetID,
    b.Amount
from
    Account act left outer join
    Balance b on act.AccountID = b.AccountID left outer join
    Asset ast on b.AssetID = ast.AssetID

我正在尝试获得以下结果:

Dictionary(of Account, Dictionary(of Asset, Double))

1 个答案:

答案 0 :(得分:0)

从内存中,左连接是使用LINQ 2 SQL语法

中的简单from语句完成的
Dim dc as new myDataContext
Dim result = from act in dc.Accounts
         from b in dc.Balance
         from ast in dc.Asset
         select act.AccountID, ast.AssetID, b.Amount