Hello,
I have a field with values from 0 to 150
Now I want a field with the following result :
NULL if the value 0
VERY LOW if the value is between 1-49
LOW if the value is between 50-119
MEDIUM if the value is between 120-149
HIGH if the value is equal or higher then 150
I already did this in oracle with DECODE and SIGN
decode(field,0,"Null",
decode(sign(field-50),-1,"Very Low",
decode(sign(field-120),-1,"Low",
decode(sign(field-150),-1,"Medium",
"High"))))
But in informix sign doesn't work!
How can help me with this?
Thanks + Greetings
Marc
↪ replying to Marc Notelteirs
If you are working with 7.3 and beyond, you can use the CASE statement
select case
when col1 is 0 then "NULL"
when col1 between 1 and 49 then "VERY LOW"
...
else 'HIGH'
end
Rudy
Marc Notelteirs wrote:
> Hello,
>
> I have a field with values from 0 to 150
>
> Now I want a field with the following result :
>
> NULL if the value 0
> VERY LOW if the value is between 1-49
> LOW if the value is between 50-119
> MEDIUM if the value is between 120-149
> HIGH if the value is equal or higher then 150
> ...Marc