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
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/280859.html