Can anyone help me with selecting multiple values from the attribute table?

I tried "Classes"='14'AND'07' but it doesn't work.


A more elegant solution is:

"Classes" in ('14','15',....)

  • In case of null USE inverted commas OR NOT e.g for above code "Classes" in (NULL,'14','15',....) OR "Classes" in ('NULL','14','15',....) N.B. Only single inverted comma care it.. – SIslam Dec 29 '14 at 13:57

You would need to break up your selection statement into two separate parts:

"Classes" = '14' AND "Classes" = '07'

Although I'm guessing that you would want to use an OR case rather than AND for this query to work properly.

  • Thanks for the suggestion RyanL. The AND in the middle does not work. But the OR works. – Stanley Anak Suab Nov 15 '13 at 8:15
  • 11
    The AND doesn't work because you cannot have both 14 and 07 in the same field for the same feature. If you have multiple cases you want to select, use the syntax: fieldname in ('value1','value2','value3') for strings or without '' for integers. – Alex Tereshenkov Nov 15 '13 at 8:35
  • What happens if I have hundreds and hundreds of values that I want the database to search and select? In fact I have a whole CSV file worth of these values... I can't possible fit them all in the little query box using SQL... Is there a more robust solution? – user32882 Jul 11 '15 at 19:31

protected by Community Jul 11 '15 at 19:30

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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