Hi,
Im joining together 2 lists in C# with this query, which works OK.
However, in my list there are are always 2 identical IDs, each with a different NAME. I want my Linq joined list to skip the item if its already been joined to a itemValue in itemRefs.
The Lists
custRefs:
ID, NAME
abc1, daytimeref
abc1, nighttimeref
bcd, daytimeref
bcd, nighttimeref
xyz, daytimerefer
xyz, nighttimeref
itemRefs:
ID, VALUE
xyz, 4512.0
bcd, 221.9
abc1, 6612.3
This is the result I want:
abc1, daytimeref, 6612.3
abc1, nighttimeref, 6612.3
bcd, daytimeref, 221.9
bcd, nighttimeref, 221.9
xyz, daytimerefer, 4512.0
xyz, nighttimeref, 4512.0
Its possible there is a much simpler way to do this than the way I am currently doing it. Thanks!
Im joining together 2 lists in C# with this query, which works OK.
Code:
var joinedList = from a1 in custRefs
join a2 in itemRefs
on a1.id equals a2.id
select new { a1.id, a1.idname, a2.itemvalue };
However, in my list there are are always 2 identical IDs, each with a different NAME. I want my Linq joined list to skip the item if its already been joined to a itemValue in itemRefs.
The Lists
custRefs:
ID, NAME
abc1, daytimeref
abc1, nighttimeref
bcd, daytimeref
bcd, nighttimeref
xyz, daytimerefer
xyz, nighttimeref
itemRefs:
ID, VALUE
xyz, 4512.0
bcd, 221.9
abc1, 6612.3
This is the result I want:
abc1, daytimeref, 6612.3
abc1, nighttimeref, 6612.3
bcd, daytimeref, 221.9
bcd, nighttimeref, 221.9
xyz, daytimerefer, 4512.0
xyz, nighttimeref, 4512.0
Its possible there is a much simpler way to do this than the way I am currently doing it. Thanks!