0

I would like to select multiple attributes which contains some specific text ("Bus", "Car", and "Motorbike") from the same field ("commodity") using Select by Expression function in QGIS. My version is QGIS 3.24.0

In case I just want to select the attributes of field "commodity" which contains the text "Bus", I use like operator:

 "commodity" like '%Bus%'

However, I also want the rows which contains other words as "motorbike" and "car". Among other things, I am trying the following:

"commodity" like ('%Bus%', '%Motorbike%', '%Car%')

However, it does not work. Any idea of how I should proceed?

1 Answer 1

4

You need to chain your LIKE expression with the OR operator so your expression become :

"commodity" like '%Bus%' OR "commodity" like '%Motorbike%' OR "commodity" like '%Car%'

(Separating value with comma work for the IN operator but not with like)

1
  • It works. Thank you!
    – OgeiD
    Commented Sep 22, 2022 at 13:45

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.