[英]Show only the first 5 characters in select SQL?
I would like to know if it is possible to show only the 5 first characters.我想知道是否可以只显示前 5 个字符。
I've tried using LEFT but couldn't.我试过使用LEFT但不能。 What I want is that when performing the query only the first 5 characters appear.
我想要的是在执行查询时只出现前 5 个字符。
EX:前任:
How is it done today:今天是怎么做的:
380.902349
380.902349
How I wanted it to be:我希望它是怎样的:
380.90
380.90
Can you help me.你能帮助我吗。
Cast after the mathematical calculation.数学计算后施放。 And, use the size of the decimal you want.
并且,使用您想要的小数的大小。 Something like this:
像这样的东西:
CAST(AVG(md-duration * 1.0) / 1000 as DECIMAL(10, 2))
您可以使用 MySQL FORMAT函数,它带有 2 个参数,第一个值和第二个您想要小数点后的位数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.