title: How to create a matrix with SQL
body: <p>With geographic data records like this:</p>
  
  <pre><code>START                  |  END
  
  CITY1    |   STATE1    |   CITY2    |  STATE2
  ----------------------------------------------
  New York |    NY       |  Boston    |   MA
  Newark   |    NJ       |  Albany    |   NY
  Cleveland|    OH       |  Cambridge |   MA
  </code></pre>
  
  <p>I would like to output something like this where it counts START/END pairings displayed as a matrix:</p>
  
  <pre><code>   |  MA  |  NJ  |  NY  |  OH
  ------------------------------
  MA |  0   |  0   |  1   |  0
  NJ |  0   |  0   |  1   |  0
  NY |  1   |  0   |  0   |  0
  OH |  1   |  0   |  0   |  0
  </code></pre>
  
  <p>I can see how <code>GROUP BY</code> and <code>COUNT</code> will find the data but I'm lost on how to display as a matrix. Does anyone have any ideas?</p>