Perform multiple left joins using Linq -
I have four tables I want to work in the following ways to connect more than one left in the table.
in Table 1 in Table 2 in Table 2 & lt; Condition1 & gt; To join Join1 1 from subJoin1 Default IFEmpty () in Table 3 & lt; Condition2 & gt; From joining in join2 to subjoin2 Default IFEmpty () in Table 4 & lt; Condition3 & gt; Join 3 in 3 from subjoin3 Default IfEmpty () New {Field1 = t1.some_field, Field2 = t2.some_field, Field3 = t3.some_field, Field4 = t4.some_field,} My problem is that before leaving The loneliness works well, but when the left joining is done continuously, the T1 data line is lost if mapping is not found in T3, T4 etc.
Please help.
You do not need in (at least yet)! Something like this
From t1 in Table 1 to 2 in Table 2 & lt; Inner_join_condition & gt; T3 in Table 3. Where (& lt; left_outer_join_condition & gt;) DefaultIfEmpty () ... Select New {Field1 = t1.some_field, Field2 = t3.some_field, ...} Generally very well!
Comments
Post a Comment