4

I don't know how to filter the attribute table in qgis. I have 2 columns, DN and DN_1, both with values from Corine Land Cover (111,112, 223, etc). I try to select the rows that have the same value. For example. DN: 111, and DN_2: 111, to erase them, and have only values that are different on the same rowenter image description here. Is there a way to filter this?

5

filter by expression with "DN"="DN_2" ? depending on the column type (string/integer) you could also try an : to_int("DN")=to_int("DN_2")

  • 1
    IS LIKE is another possibility and would omit the to_int. – Erik Apr 17 at 10:56
1

Another solution via using regexp_match() and trim()

Since the match has to be checked both ways means the regexp_match() has to be applied twice using the conjunction AND to achieve the exact match.

regexp_match(trim("DN"), trim("DN_2")) AND regexp_match(trim("DN_2"), trim("DN"))

A Λ B is true only if A is true and B is true


regexp_match(input_string, regex)
Returns true if any part of a string matches the supplied regular expression
input_string the string to test against the regular expression
regex the regular expression to test against


trim(string)
Removes all leading and trailing whitespace (spaces, tabs, etc) from a string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.