LINQ通过不工作离开加入团队

时间:2013-05-17 16:41:06

标签: vb.net linq

使用左连接和分组工作时,我很难获得LINQ查询。下面给出了一个空数据集,它不应该:

 Dim SiebelNonExistPDP = From PLI In ProdBase _
                                Group Join EDTK In eDTKBase _
                                On PLI.Siebel_PDP_Code Equals EDTK.eDTK_PDP_Code _
                                Into g = Group _
                                From EDTK In g.DefaultIfEmpty _
                                Where EDTK Is Nothing _
                                    And Not PLI.Siebel_PDP_Code Is Nothing _
                                Select PLI.Siebel_PLI, _
                                       EDTK.eDTK_PDP_Code, _
                                       PDP_Description = If(EDTK.PDD_PDP_Description Is Nothing, Nothing, EDTK.PDD_PDP_Description)

我以前一直在使用相同的查询,但有一个额外的连接工作正常,但当我删除第二个连接时查询不起作用。这是第二个连接的查询:

 Dim SiebelNonExistPDP = From PLI In ProdBase _
                            Group Join EDTK In eDTKBase _
                            On PLI.Siebel_PDP_Code Equals EDTK.eDTK_PDP_Code _
                            Into g = Group _
                            From EDTK In g.DefaultIfEmpty _
                            Group Join PDD In PDDBase _
                            On PLI.Siebel_PDP_Code Equals PDD.PDD_PDP_Code _
                            Into f = Group _
                            From PDD In f.DefaultIfEmpty _
                            Where EDTK Is Nothing _
                                And Not PLI.Siebel_PDP_Code Is Nothing _
                            Select PLI.Siebel_PLI, _
                                   PLI.Siebel_PDP_Code, _
                                   PDP_Description = If(PDD Is Nothing, Nothing, PDD.PDD_PDP_Description)

我不明白为什么在这种情况下删除其中一个连接会导致另一个连接失败。我错过了什么?

0 个答案:

没有答案
相关问题