add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
@cols
c1.id2,c2.id2,c3.id2
@tables
combinationTable c1 CROSS JOIN combinationTable c2 CROSS JOIN combinationTable c3
@conditions
c1.rn < c2.rn AND c2.rn < c3.rn
@sql
WITH combinationTable AS (
 SELECT DENSE_RANK() OVER (ORDER BY id1) AS rn ,id2, id1 FROM mytable
)
SELECT c1.id2,c2.id2,c3.id2
FROM combinationTable c1 CROSS JOIN combinationTable c2 CROSS JOIN combinationTable c3
WHERE c1.rn < c2.rn AND c2.rn < c3.rn;
id2 id2 id2
1 3 4
2 3 4
@cols
c1.id2,c2.id2,c3.id2,c4.id2
@tables
combinationTable c1 CROSS JOIN combinationTable c2 CROSS JOIN combinationTable c3 CROSS JOIN combinationTable c4
@conditions
c1.rn < c2.rn AND c2.rn < c3.rn AND c3.rn < c4.rn
@sql
WITH combinationTable AS (
 SELECT DENSE_RANK() OVER (ORDER BY id1) AS rn ,id2, id1 FROM mytable
)
SELECT c1.id2,c2.id2,c3.id2,c4.id2
FROM combinationTable c1 CROSS JOIN combinationTable c2 CROSS JOIN combinationTable c3 CROSS JOIN combinationTable c4
WHERE c1.rn < c2.rn AND c2.rn < c3.rn AND c3.rn < c4.rn;
id2 id2 id2 id2
1 3 5 6
1 3 4 6
2 3 5 6
2 3 4 6