在查询中使用双精度 [英] Using double precision in query

查看:67
本文介绍了在查询中使用双精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 double precision 列查询表,但是当我尝试

I want to query a table using a double precision column but when I try

从foo中选择*,其中bar> 2

我没有结果。

选择*来自foo,其中bar< 2

也没有!当我尝试

从foo中选择酒吧

我可以在那里看到所有记录。一些值例如 1.31744579794415e-08 4.82082769315891e-08 等。

I can see all records there. Some values are like 1.31744579794415e-08, 4.82082769315891e-08 and etc.

已经尝试过 bar< 2.0 bar< 2.0 :: float8

我在做什么错了?

推荐答案

此解决方案有效吗?

select * from foo where round(bar::numeric, 2) < 2 

但是我很惊讶,因为所有这些断言都是正确的:

But I am surprised since all those assertions are true :

select round(1.31744579794415e-08::numeric, 2) < 2 
select 1.31744579794415e-08::numeric < 2 
select 1.31744579794415e-08 < 2 

您确定没有其他东西了吗?

Are you sure there is nothing else ?

这篇关于在查询中使用双精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆