4

I need to filter features that have attributes that start within a relative number range. I am using brackets to filter the range of numbers, but it does not work me. This is my query:

CASE
WHEN  "nombre"  like '[0-3]%' THEN 'ROSETAS'
WHEN  "nombre"  like '[4-5]%' THEN 'CTO'
ELSE 'OTRAS'
END
4

You can use the regexp_match function to match the first number inside your CASE statements:

CASE
WHEN regexp_match("nombre", '^[0-3].*') THEN 'ROSETAS'
WHEN regexp_match("nombre", '^[4-5].*') THEN 'CTO'
ELSE 'OTRAS'
END 
  • @jfaneca - Haha most welcome =) – Joseph May 17 '16 at 11:21

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.