1 2 3 4 5 6 7 8
SELECT DISTINCT i1.key, i2.key, i1.subkey FROM plato.Input AS i1 JOIN plato.Input AS i2 on i1.key == i2.subkey ORDER BY i1.key, i2.key, i1.subkey ;