如果我有类似的话:
select sum(pets.dogs)
from pets, city
WHERE ST_Within(pets.dogs, city.geom);
这可以比每个value is between 1-1000
And if value is within 1-100, output A
within 101-200, output B
within 201-300, output C
within 301-400, output D
within 401-500, output E
else, output F
语句更“有效”或更好地完成吗?
答案 0 :(得分:1)
您可以使用值和输出之间的映射:
outputs = [ A, B, C, D, E, F, F, F, F, F]
output = outputs[(int)((value - 1)/ 100)]