title: How to sum and pivot a table in SQL?
body: <p>I have the following table:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>col_a</th>
  <th>col_b</th>
  <th>col_c</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>0</td>
  <td>1</td>
  </tr>
  <tr>
  <td>0</td>
  <td>1</td>
  <td>0</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I want to sum up each column and assign a value to it based on the output, with the output like-so below:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>column</th>
  <th>sum</th>
  <th>string</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>col_a</td>
  <td>1</td>
  <td>'string one'</td>
  </tr>
  <tr>
  <td>col_b</td>
  <td>1</td>
  <td>'string two'</td>
  </tr>
  <tr>
  <td>col_b</td>
  <td>1</td>
  <td>'string three'</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I've tried the following SQL:</p>
  <pre><code>SELECT
  SUM(col_a) AS sum_a,
  SUM(col_b) AS sum_b,
  SUM(col_c) AS sum_c
  FROM table
  </code></pre>
  <p>This gives me three total columns, but I've been unable to figure out the rest.</p>
  <p>Greatly appreciated!</p>