title: SQL Query to aggregate contract across product type
body: <p>I have a table</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Product</th>
  <th style="text-align: center;">Product detail</th>
  <th style="text-align: right;">System</th>
  <th style="text-align: right;">Contract Number</th>
  <th style="text-align: right;">Date closing deal</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">cheese</td>
  <td style="text-align: center;">gouda</td>
  <td style="text-align: right;">Supermarket</td>
  <td style="text-align: right;">12346</td>
  <td style="text-align: right;">11.03.2021</td>
  </tr>
  <tr>
  <td style="text-align: left;">cheese</td>
  <td style="text-align: center;">gouda</td>
  <td style="text-align: right;">Supermarket</td>
  <td style="text-align: right;">12345</td>
  <td style="text-align: right;">12.03.2021</td>
  </tr>
  <tr>
  <td style="text-align: left;">cheese</td>
  <td style="text-align: center;">Maasdam</td>
  <td style="text-align: right;">Store</td>
  <td style="text-align: right;">67837</td>
  <td style="text-align: right;">14.03.2021</td>
  </tr>
  <tr>
  <td style="text-align: left;">cheese</td>
  <td style="text-align: center;">Maasdam</td>
  <td style="text-align: right;">Supermarket</td>
  <td style="text-align: right;">67832</td>
  <td style="text-align: right;">13.03.2021</td>
  </tr>
  <tr>
  <td style="text-align: left;">Tomatoes</td>
  <td style="text-align: center;">Red</td>
  <td style="text-align: right;">Store</td>
  <td style="text-align: right;">98237</td>
  <td style="text-align: right;">13.03.2021</td>
  </tr>
  <tr>
  <td style="text-align: left;">Tomatoes</td>
  <td style="text-align: center;">green</td>
  <td style="text-align: right;">Store</td>
  <td style="text-align: right;">09123</td>
  <td style="text-align: right;">13.03.2021</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The question that I am trying to answer is how many contract are closed for Red and green tomatoes in store system, and Maasdam and gouda if it's from Supermarket system?</p>
  <p>I have tried the following query but cannot figure out how to describe the specific criteria for the <code>System</code> field:</p>
  <pre><code>Select product detail, count(Contract)
  from table where [product detail] in ('Gouda', 'Maasdam', 'Red', 'Green') 
  Group by [product detail]
  </code></pre>