首页 > 其他分享 >数据格式转换 x亿xxxx万xxxx,小数的 x亿xxxx万xxxx.xx

数据格式转换 x亿xxxx万xxxx,小数的 x亿xxxx万xxxx.xx

时间:2023-03-03 10:57:25浏览次数:48  
标签:cnt right xxxx xx num 数据格式 CONCAT left

x亿xxxx万xxxx
case
        when LENGTH(t.cnt)>8 then CONCAT(left(t.cnt,length(t.cnt)-8),"亿",substr(right(t.cnt,8),1,4),"万",right(t.cnt,4))
        when LENGTH(t.cnt)>4 then CONCAT(left(t.cnt,length(t.cnt)-4),"万",RIGHT(t.cnt,4))
        else t.cnt        
        end convertnum

x亿xxxx万xxxx.xx
select concat(o.convertnum,o.cc) from( select case when LENGTH(t.cnt)>8 then CONCAT(left(t.cnt,length(t.cnt)-8),"亿",substr(right(t.cnt,8),1,4),"万",right(t.cnt,4)) when LENGTH(t.cnt)>4 then CONCAT(left(t.cnt,length(t.cnt)-4),"万",RIGHT(t.cnt,4)) else t.cnt end convertnum, cc from( select POSITION("."in r.num) as aa, left(r.num,POSITION("."in r.num)-1) as cnt, substr(r.num,POSITION("."in r.num)) as cc from (select "12345678900.56" as num) r )t ) o

 

标签:cnt,right,xxxx,xx,num,数据格式,CONCAT,left
From: https://www.cnblogs.com/zhjvvvvvv/p/17174765.html

相关文章