Mysql 浮点型问题 [英] Mysql float type issue

查看:46
本文介绍了Mysql 浮点型问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前在这里发布了一个问题,并得到了一个很棒的答案!坚持构建 mysql 查询

I have posted a question here earlier and got an awesome answer! Stuck in building mysql query

但它缺少片刻!

我在mysql表中有一个列,定义为:

I am having a column in mysql table, defined as:

`bet_price` float(10,2) NOT NULL DEFAULT 0.00,

对于某一行,值是:10000

查询如:SELECT bet_price, MIN(bet_price) AS min_price WHERE ID = :id

会返回这样的数据:

bet_price | min_price
---------------------
 10000    | 10000.00

在查询中这部分对我来说失败了.

And in queries this part fails for me.

我曾尝试使用像 FORMATTRUNCATE 这样的函数 - 但这对我没有帮助.

I've tried to use a functions like FORMAT and TRUNCATE - but this did not help me.

推荐答案

在输出渲染中可能存在某些转换的隐式转换,因此如果您需要始终相同的值,则正确转换

could be there are some implicit conversion of some conversion in output rendering so if you need always same value then cast properly

   cast(a.bet_price as decimal(10,2), MIN(b.bet_price)

  a.bet_price , cast(MIN(b.bet_price) as UNSIGNED)

这篇关于Mysql 浮点型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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