6

In QGIS is there a way to filter a layer using the Query Builder to show all values which include a particular phrase. For example I have a list of organisations and I want to filter all those which include the word Wales. I can do this using the attribute table but not in the map view so that the map just shows these selected features.

0

1 Answer 1

7

Use "LIKE" with percentages.

In my shapefile of countries I can select any country with a name like "This and that" with:

"CNTRY_NAME" LIKE '% and %'

this selects only "Bosnia and Herzegovina". If I remove the spaces:

"CNTRY_NAME" LIKE '%and%'

I get Iceland, England and all the others with "and" in them.

That all works for shapefiles - the help for the query builder mentions that the syntax and behaviour may depend on your data source.

2
  • That's just what I needed. Thank you so much Spacedman!!
    – user34823
    Aug 1, 2014 at 20:03
  • Could you tick the little tick next to my answer to show that this question has now been answered?
    – Spacedman
    Aug 3, 2014 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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