I have 2 data tables:
Table1
ID: [1, 2]
Name: ["A", "B"]
Table2
ID: [1, 2, 3]
NameID: [1, 2, 2]
Action: ["test", "test", "don't test"]
If I want to get the following query:
Table2.ID: [1, 2, 3]
Table2.NameID: [1, 2, 2]
Table2.Action: ["test", "test", "don't test"]
Table1.ID: [1, 2, 2]
Table1.Name: ["A", "B", "B"]
I would write, in SQL, the following:
SELECT *
FROM Table2 LEFT JOIN Table1 ON Table2.NameID = Table1.ID
What's an equivalent expression I can write in LINQ?
I don't want to have to write the field names out. I would rather just write a Select All where the duplicates are immediately resolved by adding a table identifier to the qualifying fields.
I also do not want to return a query with two list fields.
Thus far, I've tried:
from x in Table2
join y in Table1
on x.NameID equals y.ID into grouping
select new { x, grouping }
But, it's returned a query of two list fields: x and grouping.