当前位置:网站首页>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(值长度,保留几位小数点))
边栏推荐
- SAP ABAP 子屏幕教程:在 SAP 中调用子屏幕-010
- win10的wifi断线后无法连接
- SAP ABAP table control and example-07
- 使用stream api替代sql
- [C language] use of library function qsort
- SAP value process & help request process-011
- JS获取数据类型方法总结
- How to add a "security lock" to the mobile office of government and enterprises?
- Runtime -- explore the nature of classes, objects, and classifications
- 论催收系统的任务调度设计
猜你喜欢

Unity game optimization (version 2) learning record 8

User exit and customer exit in SAP ABAP -015

SAP ABAP 中的 Smart Forms-014

Google Chrome small details

Make the code elegant (learn debugging + code style)

SLAM十四讲之第6讲--非线性优化

jsp學習之(二)---------jsp脚本元素和指令

2022年中国重卡智能化升级专题研究

Conversion between numeric types and strings

超出文本部分用省略号表示
随机推荐
【微信小程序封装底部弹出框二】
SAP ABAP sub screen tutorial: call sub screen -010 in SAP
2.接口(计算器)
Ironsource Luna offers a limited time discount for Apple search ads and enjoys 3 months of free service upon registration
SAP ABAP 报告编程-08
使用枚举实现工厂模式
5.文件的读写(学生类)
'不敢去怀疑代码,又不得不怀疑代码'记一次网络请求超时分析
for..of vs. for..in 语句
Unity game optimization (version 2) learning record 8
LeetCode_回溯_动态规划_中等_131.分割回文串
论催收系统的任务调度设计
Jsp Learning (2) - - jsp script Elements and instructions
ALV report in SAP tutorial - ABAP list viewer -012
GD32F4xx MCU 驱动mcp2515扩展CAN接口
[C language] deeply analyze the relationship between pointer and array
Shell learning
SAP 脚本教程:SE71、SE78、SCC1、VF03、SO10-013
sql语法检测
机器学习笔记 - HaGRID—手势识别图像数据集简介