title: Calculate ratio between 2 rows in PSQL
body: <p>I have a table like</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>groupid</th>
  <th>numofproducts</th>
  <th>matches</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>5</td>
  <td>false</td>
  </tr>
  <tr>
  <td>1</td>
  <td>1</td>
  <td>true</td>
  </tr>
  <tr>
  <td>2</td>
  <td>1</td>
  <td>true</td>
  </tr>
  <tr>
  <td>2</td>
  <td>1</td>
  <td>false</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>and need to calculate a simple ratio along the lines of</p>
  <blockquote>
  <p>for a group, calculate the ratio of matches to the total set of products</p>
  </blockquote>
  <p>so for group 1 the ratio would be 1/6, or 16.67%, group 2 would be 1/2 or 50%</p>