select
订单ID as 原始订单id,
substr(到货日期,1,10) as 到货日期,
cast(REPLACE(订单ID,substr(订单ID,1,2),'C') as text) as 订单ID,
'C' || substr(订单ID,3,10) as neworder_id,
货主城市,
(应付金额 - 运货费)as 利润,
ceil((应付金额 - 运货费))as 利润整数,-- round 四舍五入 ceil 向上取整 floor向下取整
round((应付金额 - 运货费),3) 利润小数,
printf("%.2f",(应付金额 - 运货费)) AS 利润小数22,
substr(printf("%.2f",(应付金额 - 运货费)),instr(printf("%.2f",(应付金额 - 运货费)),"."),3) AS 利润小数25
from
订单