根据Postgres中的某些字符拆分数据 [英] Splitting data based on some character in Postgres
本文介绍了根据Postgres中的某些字符拆分数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一列如下。该列是可变的,表示长度始终在变化:
I have a column like below. The column is variable means the length changes all the time:
{200;62;38;200;0;100
{200;62;38;200;0;100;200;0;100
{200;62;38;200;0;100;200;0;100;200;0;100
我需要做的是在SQL中按如下所示拆分此列
what I need to do is split this column in SQL as below
{200 62 38 200 0 100 200 0 100
这应该位于目标的自己的列下,因此请根据分隔符进行划分; 这是表中的列。
this should come under their own column the goal so split them based on divider ; this is a column in the table.
推荐答案
这可以使用 regexp_replace :
select * from regexp_replace('{200;62;38;200;0;100', ';',' ','g')
输出为:
{200 62 38 200 0 100
这篇关于根据Postgres中的某些字符拆分数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文