当前位置:网站首页>mysql 字符串字段转浮点型字段
mysql 字符串字段转浮点型字段
2022-06-22 15:23:00 【夜七天】
mysql 转换类型用两个函数:CONVERT(字段/需要转换的值, 类型) CAST(字段/需要转换的值 AS 类型)
因为之前设计,将某表金额字段类型设置为varchar
现在需要对此表根据用户,和表数据的类型进行汇总。
计算时,需要转换类型。
刚开始用了 CONVERT(jo.`pay_money`, DECIMAL) 此方式,输出的结果为整形。
后想起 DECIMAL 的声明语法 DECIMAL(M,D)
·M是数字的最大数(精度)。其范围为1~65(在较旧的MySQL版本中,允许的范围是1~254)。
·D是小数点右侧数字的数目(标度)。其范围是0~30,但不得超过M。
其默认的保留小数点位数是0
估修改类型转换sql :CONVERT(字段, DECIMAL(值长度,保留几位小数点))
边栏推荐
- Implementing factory mode using enumeration
- [deep anatomy of C language] keywords if & else & bool type
- Parts beyond the text are indicated by ellipsis
- 数睿数据受邀参与南通企业数字化转型研讨会
- SAP ABAP 表控制与示例-07
- Cmake tutorial series-00-introduction
- Task scheduling design of collection system
- 同花顺怎么开户?网上开户安全么?
- 【小程序项目开发-- 京东商城】uni-app开发之分包配置
- 【小程序项目开发-- 京东商城】uni-app开发之轮播图
猜你喜欢

What is SAP ABAP? Type, ABAP full form and meaning

过气剧本杀,被露营“复活”

Make the code elegant (learn debugging + code style)

Conversion between numeric types and strings

SAP ABAP dialog programming tutorial: module pool in -09

Google Chrome small details

SAP 脚本教程:SE71、SE78、SCC1、VF03、SO10-013

首个赛博格人陨落背后:科技与渐冻症的极限赛跑

Pod type

SAP web service cannot log in to SOA management page with soamanager
随机推荐
2.接口(计算器)
使用IDM让百度云加速的方法
JS method for judging data type of interview questions
对ABAP程序调优的学习(四)LOOP WHERE KEY
Parts beyond the text are indicated by ellipsis
SAP ABAP report programming-08
用递归法求Fibonacci数列第n项的值
NiO file and folder operation examples
nio服务多线程版本
SAP ABAP 中的 Smart Forms-014
买网红雪糕的我,成了大冤种
浙江创投圈的“半壁江山”,还得是国资
Smart forms-014 in SAP ABAP
Deploy odoo to the server and configure it as a service
Conversion between numeric types and strings
SAP 中的 ABAP 查询教程:SQ01、SQ02、SQ03-017
Summary of safari compatibility issues
执行逻辑大同小异的实现类使用模板模式
什么是 SAP ABAP? 类型、ABAP 完整形式和含义
SAP ABAP 报告编程-08