0
SELECT 
    a.Description,
    b.DescriptionLng1,
    c.DescriptionLng1
FROM 
    [xxx].[dbo].[Values] AS a
LEFT OUTER JOIN
    AttributeLists AS b ON a.SelectedListIdent = b.AttributeListIdent
LEFT OUTER JOIN
    AttributeLists AS c ON a.ValueListIdent =c.AttributeListIdent
WHERE
    SourceIdent = 8203 AND TestSampleIdent = 8900
ORDER BY
    UniqueAttributeIdentPerTest ASC

How can I realize that query in vb.net using linq? Below you can see a first attempt. With "Group Join" I am able to realize the left outer join via linq. But how can I do that with one than more "left outer join" queries?

Dim Query11 = From rows In DBContext.TCPD_ResultValues
              Group Join rows2 In DBContext.TCPR_AttributeLists On rows.SelectedListIdent Equals rows2.AttributeListIdent
              Group Join rows3 In DBContext.TCPR_AttributeLists On rows.ValueListIdent Equals rows3.AttributeListIdent Into Group
              Where CInt(rows.SourceIdent) = Page_OrderRequest.TestIdent And CInt(rows.TestSampleIdent) = Me.SelectedTestSampleIdent
              From rows2 In Group.DefaultIfEmpty()
              From rows3 In Group.DefaultIfEmpty()
              Select rows, rows2, rows3
              Order By rows.UniqueAttributeIdentPerTest Ascending

For Each elem11 In Query11
Hias
  • 45
  • 6
  • Perhaps my [SQL to LINQ Recipe](https://stackoverflow.com/questions/49245160/sql-to-linq-with-multiple-join-count-and-left-join/49245786#49245786) might help you. – NetMage Feb 23 '23 at 17:47

0 Answers0