I have the following LINQ query where clause which isn't returning the expected result. dtTemp row.Item(0) has values like "GE", "LE", "ST", "PL" while Stkyard is a string array with one or more of these values.
I am expecting the below query to filter values based on entry in Stkyard but the returned result set has sum of all values in dtTemp
dtQuery = (From row In dtTemp
Group row By grp =
New With {Key .mth = row.Item(1), Key .mthdesc = row.Item(2)} Into Group,
val1 = Sum(Convert.ToDecimal(row.Item(3))), val2 = Sum(Convert.ToDecimal(row.Item(4)))
Where Group.Any(Function(p) Stkyard.Contains(p.Item(0)))
Select New With {grp.mth, grp.mthdesc, val1, val2}
Distinct).ToList
Any help?
DonNetFiddle Example