postgresql中比较real类型相等的正确方法

    xiaoxiao2026-06-16  12

    先说结论,正确的方法类似如下语句: select vat from expenses where round(vat::numeric, 2) = 19.66; 而不能直接用相等: select vat from expenses where vat = 19.66; 参考: http://www.peterbe.com/plog/comparing-real-values 当你遇到诸如0.01的值时直接使用=则得不到你想要的结果。
    最新回复(0)