原因:因不确定唯一主键
解决办法 :
1.创建索引
CREATE UNIQUE INDEX LSY_ZBX_ALL_idx ON LSY_ZBX_ALL (id);
注:若没有唯一主键值,可创建id列(执行一下sql)
UPDATE LSY_ZBX_ALL SET ID = ROWNUM(填充索引列)
3.sql (由于 A重复,需B以逗号拼接)
SELECT DISTINCT
A,listagg (B, ',') WITHIN GROUP (ORDER BY B)
over(partition by A) B
from (SELECT
* FROM
LSY_ZBX_GT tt
WHERE
tt.A IN (
SELECT
tt2 .A
FROM
LSY_ZBX_GT tt2
GROUP BY
tt2 .A
))
4.创建表以查询出列为基础
create table t_A_LSY as select * from t_B_LSY
5,多表取并集(需相同的列)
select "唯一主键","编码" from A
union
select "唯一主键","编码" from B
union
select "唯一主键","编码" from C
union
select "唯一主键","编码" from D
空白格己 发布了11 篇原创文章 · 获赞 7 · 访问量 1566 私信 关注