title: How to generate a permutations or combinations of n rows in m columns?
body: <p>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?</p>
  
  <p>For example the original table has 1 column (number_value) with 3 (n=3) rows:</p>
  
  <pre><code>1
  2
  3
  </code></pre>
  
  <p>The table which contains combinations (the order doesn't matter) of two values (m = 2) would be the following:</p>
  
  <pre><code>number1, number2
  1,2
  1,3
  2,3
  </code></pre>
  
  <p>and the table of permutations would be the following:</p>
  
  <pre><code>number1, number2
  1, 2
  2, 1
  1, 3
  3, 1
  2, 3
  3, 2
  </code></pre>
  
  <p>The order of rows doesn't matter.</p>
  
  <p>Thank you in advance!</p>