2条回答
默认
最新
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
墨值悬赏
匿名用户PostgreSQL 里面有列转行的函数吗?
postgres=# select * from test.test_str;
no | name
----+------------
1 | a,b,c,d
2 | Jason Xian
(2 rows)
将列信息转换成行
postgres=# select regexp_split_to_table(name,',') from test.test_str where no=1;
regexp_split_to_table
-----------------------
a
b
c
d
(4 rows)
postgres=# select regexp_split_to_table(name,' ') from test.test_str where no=2;
regexp_split_to_table
-----------------------
Jason
Xian
(2 rows)
postgres=# select regexp_split_to_table('hello world', '\s+');
regexp_split_to_table
-----------------------
hello
world
(2 rows)
评论
有用 0
评论
有用 2
墨值悬赏