title: Google BigQuery SQL for summing individual columns
body: <p>I'm after an efficient(ish) BigQuery SQL query to address the following:</p>
  
  <p>I've got a table that looks like so:</p>
  
  <pre>
  
      <code>
      Row | Col_A | Col_B |
      ---------------------
       1  |   2   |   3   |
       2  |   1   |   4   |
       3  |   5   |   7   |
       4  |   2   |   3   |
       5  |   6   |   1   |
  
      ...and so on (>million rows)
      </code>
  
  </pre>
  
  <p>The value of each column is an ID with the range [1..7].</p>
  
  <p>The query should produce the following i.e. sum every code for each column:</p>
  
  <pre>
  
      <code>
      Code | Total Col_A | Total Col_B
      --------------------------------
        1  |      1      |      0  
        2  |      2      |      0  
        3  |      0      |      2  
        4  |      0      |      1  
        5  |      1      |      0  
        6  |      1      |      0  
        7  |      0      |      1
      </code>
  
  </pre>
  
  <p>Anyone know of a way of doing this in BigQuery without using multiple SELECTs?</p>
  
  <p>Cheers.</p>