原始数据如下,要拆分dict_label字段:
selectt_d.dict_sort,t_d.dict_label,t_d.dict_value
from sys_dict_data t_d
where t_d.dict_type = 'qc_audit_type' ORDER BY t_d.dict_sort
关键代码:
split_part(t_d.dict_label,',',1) as mValue,
split_part(t_d.dict_label,',',2) as xValue,
全部代码:
selectt_d.dict_sort,t_d.dict_label,split_part(t_d.dict_label,',',1) as mValue,split_part(t_d.dict_label,',',2) as xValue,t_d.dict_value
from sys_dict_data t_d
where t_d.dict_type = 'qc_audit_type' ORDER BY t_d.dict_sort
结果如下: