参考地址:https://blog.csdn.net/weixin_39540651/article/details/104058493
PG两整数相除为0
例:当分母大于分子的时候,整数相除得到的结果为0
解决方案:
select 20/100::numeric
得到结果:
如果需要保留几位小数,再用cast进行转换即可,直接用cast是无法转换的
参考地址:https://blog.csdn.net/weixin_39540651/article/details/104058493
PG两整数相除为0
例:当分母大于分子的时候,整数相除得到的结果为0
解决方案:
select 20/100::numeric
得到结果:
如果需要保留几位小数,再用cast进行转换即可,直接用cast是无法转换的