我想生成所有可能的变化,而不重复。我已经准备了一个数据集和查询,以及预期的结果
with t as (
select 'A' as col1 from dual
union all
select 'B' as col1 from dual
union all
select 'C' as col1 from dual
)
select * from t
或
with t as (
select 'A' as col1, 'B' as col2, 'C' as col3 from dual
)
select * from t
我想得到什么?:
A;
A;B
A;B;C
A;C
B;
B;C
C;
行的顺序不相关,元素没有顺序,因此它们不能:A;B和B;A
它可以工作,但返回重复的变体:
select sys_connect_by_path( col1, ';' )
from t
connect by nocycle col1 <> prior col1
1条答案
按热度按时间1tuwyuhd1#
可以使用下面的代码: