I need to calculate a score based on an area field using these ranges:
if >= 30000 (square meters) then 4 (score)
if < 30000 AND >= 10000 then 3
if < 10000 AND >= 5000 then 1
if < 5000 then 0
I've tried with the CASE
function but it only works for lines with a single operator (i.e. >=30000 then...) Lines with two operators (where I wrote AND
) are seemingly not supported. Here is one of the syntaxes I've tried.
CASE
WHEN Surface >= 30000 THEN 4
WHEN Surface < 30000 >= 10000 THEN 3
WHEN Surface < 10000 >= 5000 THEN 1
ELSE 0
END
The result of this exact command in the score column are only 4 or 0. Which makes me understand that the first line works but not the others.
I know SQL has its BETWEEN
operator, which would probably be a good solution to my syntax issue, but I don't see it in the field calculator.
So I'm wondering if another function could help me here or if I just need the correct syntax.