title: Calculate the number of active clients for each month (SQL)
body: <p>i'm currently doing a query for my job and I need a little bit of help with it.
  My database is really simple</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>client_id</th>
  <th>status</th>
  <th>start_date</th>
  <th>end_date</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>active</td>
  <td>2020-01-01</td>
  <td>2020-03-15</td>
  </tr>
  <tr>
  <td>1</td>
  <td>inactive</td>
  <td>2020-03-15</td>
  <td>null</td>
  </tr>
  <tr>
  <td>2</td>
  <td>active</td>
  <td>2020-01-01</td>
  <td>null</td>
  </tr>
  <tr>
  <td>3</td>
  <td>active</td>
  <td>2020-01-01</td>
  <td>2021-04-28</td>
  </tr>
  <tr>
  <td>3</td>
  <td>inactive</td>
  <td>2021-04-28</td>
  <td>2020-07-28</td>
  </tr>
  <tr>
  <td>3</td>
  <td>active</td>
  <td>2021-07-28</td>
  <td>null</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>For each new status of a given client, the database will have a new line and the previous will be updated. There are many different statuses that a client can be in but this is irrelevent for this case.</p>
  <p>i need to get, for each month, the number of active clients and i'm a bit struguling with it. I've tried using a partition and i can give the active clients for a range of dates but do not have the monthly distribution.</p>
  <p>Can anyone give my some advice :)</p>
  <p>Thanks</p>