我有以下LINQ查询where子句,它没有返回预期的结果。 dtTemp row.Item(0)
的值为"GE", "LE", "ST", "PL"
,而Stkyard
是包含一个或多个这些值的字符串数组。
我希望以下查询根据Stkyard
中的条目过滤值,但返回的结果集包含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
任何帮助?
DonNetFiddle Example