c# - LINQ querying same table -
i'm trying find rows invoice numbers same there different cities.
i'm getting cannot implicitly convert type 'system.collections.generic.ienumerable' 'bool' error when running code.
from datarowview in dv ( datarowview s in dv i.row["invoiceno"] == s.row["invoiceno"] && i.row["city"] != s.row["city"] select s ) select i;
so on set of info {123, seattle,...}, {123, seattle,...}, {123, portland,...} want 1 (in case) {123, portland,...} returned.
i'm not sure i'm doing wrong...
where
needs followed boolean indicating whether or not item should included. provided sequence of rows. doesn't tell where
whether or not should include item.
you're trying bring together table against itself, you're improve off using join
, , applying filter on joined results:
var query = first in dv bring together sec in dv on first.row["invoiceno"] equals second.row["invoiceno"] first.row["city"] != second.row["city"] select first;
c# linq
No comments:
Post a Comment