【发布时间】:2018-03-30 10:04:01
【问题描述】:
我有下表和以下数据
id description
1 a,b,a
我需要一个 PostgreSQL 脚本来给我下面的输出
id description
1 a,b
这是我迄今为止尝试过的。
create temporary table test
(
id integer,
description text
);
insert into test
select 1,'a,b,a';
select id,string_agg(distinct description, ',') as description
from test
group by id;
【问题讨论】:
-
请澄清。您至少可以提供
CRATE TABLE和INSERT语句作为示例吗? XML 是从哪里来的?
标签: sql postgresql split postgresql-9.2