title: Subtract 2 different dates with different criteria in SQL Server
body: <p>I have a question based on the below table -</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Cancel</th>
  <th>Product ID</th>
  <th>Inception Date</th>
  <th>Timestamp</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>No</td>
  <td>120</td>
  <td>12/08/2020</td>
  <td>02/02/2018</td>
  </tr>
  <tr>
  <td>No</td>
  <td>120</td>
  <td>12/06/2016</td>
  <td>10/02/2016</td>
  </tr>
  <tr>
  <td>No</td>
  <td>120</td>
  <td>12/02/2017</td>
  <td>15/01/2021</td>
  </tr>
  <tr>
  <td>Yes</td>
  <td>120</td>
  <td>12/02/2021</td>
  <td>03/03/2021</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I would like to subtract dates from 2 different columns -  minimum of Inception Date i.e. 12/06/2016 and Timestamp where the cancel flag is Yes i.e. 03/03/2021 to get the number of days.</p>
  <p>So, 12/06/2016 - 03/03/3021.</p>
  <p>How can I achieve this?</p>
  <p>Thank you!</p>
  <p>Edit: The above table is just a snippet and I have a lot more rows in the original table - more than 3000.</p>