数据库
首页 > 数据库> > MySQL 内置函数 持续更新

MySQL 内置函数 持续更新

作者:互联网

MySQL取整函数

四舍五入 round()/round(‘值’,小数点位数)



round(((po.gross_weight-po.tare_weight)-(pc.weight_deduction*0.001)),2) as actual_tonnage,

向下取整 FLOOR()



FLOOR(FLOOR(p.price * (((po.gross_weight-po.tare_weight)-(pc.weight_deduction*0.001))) - pc.sealing_tube)) as actual_price


向上取整 CEILING () 暂无应用

CASE 语法

CASE
WHEN cond1 THEN value1
WHEN cond2 THEN value2
WHEN condN THEN valueN
ELSE value
END;


            (case 
            when l.amount_status = 0 then '待审核' 
            when l.amount_status = 1 then '待付款' 
            when l.amount_status = 2 then '审核不通过' 
            else '已付款' end) as status


标签:status,内置,函数,weight,FLOOR,WHEN,pc,MySQL,po
来源: https://www.cnblogs.com/depressiom/p/16591031.html