Does anyone know how to create a table with m columns from table of n rows where the values in columns of each row represent a different combination or permutation of values from the original table?
For example the original table has 1 column (number_value) with 3 (n=3) rows:
SELECT T1.x, T2.x FROM your_table T1 JOIN your_table T2 ON T1.x < T2.x
SELECT T1.x, T2.x FROM your_table T1 JOIN your_table T2 ON T1.x != T2.x
I am assuming that the values in the original table are unique.
To generalize for larger values of m you need to add more joins.