select a, wm_concat(b) from ( select 字段 a,内容 b from your_table group by 字段,内容 ) group by a;
CREATE TABLE test1( name varchar2(20), col2 varchar2(10) );INSERT INTO test1(name, col2) values('张三', 'a'); INSERT INTO test1(name, col2) values('张三', 'b'); INSERT INTO test1(name, col2) values('张三', 'a');INSERT INTO test1(name, col2) values('李四', 'a'); INSERT INTO test1(name, col2) values('李四', 'a'); INSERT INTO test1(name, col2) values('李四', 'b'); INSERT INTO test1(name, col2) values('李四', 'c'); INSERT INTO test1(name, col2) values('李四', 'c');COMMIT;SELECT name, wm_concat(col2) as b FROM (SELECT distinct name, col2 FROM test1 order by name asc, col2 asc) t GROUP BY name order by name;
from (
select 字段 a,内容 b
from your_table
group by 字段,内容
)
group by a;
name varchar2(20),
col2 varchar2(10)
);INSERT INTO test1(name, col2) values('张三', 'a');
INSERT INTO test1(name, col2) values('张三', 'b');
INSERT INTO test1(name, col2) values('张三', 'a');INSERT INTO test1(name, col2) values('李四', 'a');
INSERT INTO test1(name, col2) values('李四', 'a');
INSERT INTO test1(name, col2) values('李四', 'b');
INSERT INTO test1(name, col2) values('李四', 'c');
INSERT INTO test1(name, col2) values('李四', 'c');COMMIT;SELECT name, wm_concat(col2) as b
FROM (SELECT distinct name, col2 FROM test1 order by name asc, col2 asc) t
GROUP BY name
order by name;