3

I found a similar question, but the answer solve the problem indirectly. So, here I reshape the question.

Say, in the following situation, how am I going to use "ELSE IF" statement?

CASE
  WHEN  "land use" != 'residential' THEN 'other land uses'
  ELSEIF  "area" < 1000 THEN 'small lot'
  ELSE 'large lot'
END

1 Answer 1

6

For your issue I can suggest trying this query

CASE
  WHEN  "land use" != 'residential' THEN 'other land uses'
  WHEN  "area" < 1000 THEN 'small lot'
  ELSE 'large lot'
END

Moreover, I recommend reading this article W3Schools | SQL CASE Statement and paying attention to CASE Syntax.

To comprehend the difference between quotation marks in QGIS please read this thread Difference between quotation marks ('single' vs “double”) in QGIS.

2
  • I read that tutorial and it seems that the when in the case statement is like the elseif in a if-elseif-else statement. Is that correct? Jul 1, 2020 at 4:03
  • 1
    More like IF and at the same time ELIF
    – Taras
    Jul 1, 2020 at 4:42

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.