5

Using QGIS 2.18. I have 346 polygons on a layer and I want to display all but one.

In this instance I wish to run a query using field ONSCode but show all except 17UB.

I have been trying to use NOT but in the wrong context and get errors.

enter image description here

12

How about "ONScode" != '17UB'

!= means "not equal to".

7

Easy way: Select '17UB' manually, then invert the selected features.

By code: "ONScode" NOT LIKE '17UB'

  • 1
    LIKE also does wildcard matching which makes the operator slightly slower (and behave slightly differently) than = and !=. For for the string 'ABC 123' the patterns 'ABC 123', 'A%', '%3' and '%C 1%' all match. The pattern '10%' matches the string '10%' but also the string '100%'. The character _ matches any single character. In QGIS 3 and later you can match a literal % or _ with \\\\% and \\\\_. Interestingly, in QGIS wildcards are implemented as regexes under the hood; this means using regexp_match should actually be slightly cheaper than simple wildcards! – Alex Hajnal Nov 7 '18 at 21:52

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.