Hello，I’m having trouble in filter datatable based on two conditions in two columns.
For example, my data table looks like:
And the condition is: Remove the rows where
- Location = “CN” AND
- Type = “AA” or “CC”
Note that the row need to be removed if and only if the two conditions are met.
So the output should be like:
I’ve tried this query:
(From r In myDT.Select()
Where (r(“Location”).ToString <> “CN” And
(r(“Type”).ToString <> “AA” Or r(“Type”).ToString <> “CC”))
but it always turns out that all the “CN”'s are removed.
I also tried to use ‘for each row’ and if statement to find rows that met the two conditions, but I stuck in remove those rows from Data Table.
Could anyone help me with this? Thank you!