title: how to get unique values from all columns based on a primary key sql
body: <p>I want to subset a table on each primary key ( A in this case), and then obtain a quick distribution for each of the remaining columns (in this case COL1: 2T,1Y,1E and for COL2: 3Z, 1B), then repeat for each primary key. </p>
  
  <pre><code>P   C1  C2
  A   T   Z
  A   T   Z
  A   Y   Z
  A   E   B
  B   W   M
  B   W   M
  </code></pre>
  
  <p>Is this possible to do in SQL (I am using WPS SQL currently)? Is it possible to loop through each primary key and then review the results, to get something along the lines of:</p>
  
  <pre><code>P C1       C2
  A 2T,1Y,1E 3Z,1B
  B 2W       2M
  ...
  </code></pre>
  
  <p>Note that my data has ~10k unique primary keys and 180 columns</p>