[postgis-users] Query result correct ?

Alexander Pucher pucher at atlas.gis.univie.ac.at
Tue Dec 9 12:38:28 PST 2003


Hi,

I'm doing an sql query on my DB that looks like this:


select aut_bez_w.the_geom,aut_bez_w.oid,temp_2.value,case
    when temp_2.value > 0.507 then 1
    when temp_2.value > 0.4674 then 2
    when temp_2.value > 0.4476 then 3
    when temp_2.value > 0.4278 then 4
    else 5
end as myclass
from aut_bez_w,temp_2
where aut_bez_w.bezirk_id = temp_2.id


the maximum value of 'temp_2.value' is 0.507, so I would assume that 
this this entry will end up in 'case 2', but it does not. The case for 
0.507 is 1!!

I don't really understand why the this happens? The query seems clear to 
me: All numbers greater (not greater equal !!) 0.507 --> case 1, all 
greater 0.4674 --> case 2 etc.

BTW, the same happens if I do this:


select aut_bez_w.the_geom,aut_bez_w.oid,temp_2.value,case
    when temp_2.value > 0.507 then 1
    else 5
end as myclass
from aut_bez_w,temp_2
where aut_bez_w.bezirk_id = temp_2.id


Any hints?

Regards,
alex.




More information about the postgis-users mailing list