I have 2 table:
Table A:
| id | Name | Age | Height |
|---|---|---|---|
| 01 | Pauls | 22 | 170 |
| 02 | Sam | 20 | 175 |
| 03 | Mike | 20 | 175 |
| 04 | Jame | 23 | 180 |
id Name Age Height 01 Pauls 20 170 02 Sam 21 180
Table B:
| id | Height | Age |
|---|---|---|
| 01 | 175 | 23 |
| 02 | 190 | 21 |
The question here is how could I get this output by join 2 table A & B by id and get output table using Linq in C# OutputTable:
| id | Name | Age | Height |
|---|---|---|---|
| 01 | Pauls | 23(value in table B) | 175 (value in table B) |
| 02 | Sam | 21(value in table B) | 190 (value in table B) |
Edit: I'm using these line of code but the output is not what I expected, I'm not used to work with linq so please tell me where's my mistake:
var results= from rowA in dA.AsEnumerable()
join rowB in dB.AsEnumerable() on rowA[id] equals rowB[id] into dAB
from subRight in dAB.DefaultIfEmpty()
select select rowLeft.ItemArray.Concat(rowRight.ItemArray).ToArray();