2

I have a Shapefile that shows local municipalities and ward boundaries for South Africa. I would like to filter this layer to only show the wards I am interested in.

For example, my first query finds two wards in a local municipality:

"LocalMun_1" = 'Alfred Duma' AND "WardNumber" IN ('28', '17')

I would now like to add two more wards from a different local municipality:

"LocalMun_1" = 'Mpofana' AND "WardNumber" IN ('2', '4')

How would I combine the two queries into the same filter expression?

3

Try with OR to assemble the two conditions:

("LocalMun_1" = 'Alfred Duma' AND "WardNumber" IN ('28', '17')) OR ("LocalMun_1" = 'Mpofana' AND "WardNumber" IN ('2', '4'))

In logic operators, OR stands for AND & OR, if the first expression is True, it adds the second one if True.

  • I cant believe it was that simple! I always thought OR meant one or the other. Thanks for your answer, worked like a charm. – JohnGIS Jul 23 at 9:29
  • 1
    Comment added in my answer. – J. Monticolo Jul 23 at 9:33

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.