1

How do I select multiple features in a vector layer using the Query Builder in QGIS?

Using U.S. Census geographic data, I'm trying to select a large number of specific block groups using the GEOID feature / field.

Based on an answer found here and using the LIKE operator, I've used the following query in the Query Builder:

"GEOID" ILIKE ('34013000100%', '34013000200%')

This results in error:

OGR[3] error 1: SQL Expression Parsing Error: syntax error, unexpected ','.

I've also tried using the LIKE and IN operators; changing the wildcard from % to _ (a single underscore); and other separators replacing the comma, all with error results.

I note that filtering for a single value (such as "GEOID" ILIKE ('34013000100%') works fine.

A sample data file is found here.

0

1 Answer 1

4

Try writing a multiple LIKE statement with the values you're trying in an IN statement.

In the image below, there are 2 sets of selected features for each LIKE statement (highlighted in pink):

"GEOID" like ('34013000100%')  
or  
"GEOID" like ('34013000200%')

enter image description here

0

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.