Bootstrap

HIVE SQL--去掉字符串最后四位

1、
利用函数嵌套,可以实现这个要求
让regexp_replace 函数 和 substr 函数嵌套一下,就可以了

select regexp_replace('3123091490A011',substr('3123091490A011',-4,4),'');

2、第二种
利用length函数

select substr(e.wbs_no,0,length(e.wbs_no)-2) from app_bz_wlxtfs_m 
;