mysql 将指定列的浮点数转化为整数

时间:2016-05-11 19:48:52   收藏:0   阅读:3580

mysql 将指定列的浮点数转化为整数:

update set B =  cast(B as decimal(10,0)) 
-- 或者
update set B = round(B,0)

 

例如:update hdcloude01.t_a01_eltable set t_a01_eltable.BatteryDal =  round(t_a01_eltable.BatteryDal, 0) where t_a01_eltable.`BatteryDal`  is not null; 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!