title: SQL query to find gaps within a column of dates
body: <p>I have a table with status and date for every day and I'm trying to find out when the statuses change and if there's gaps within each status change / how many days were of a certain status.</p>
  <pre><code>+------+----------------+--------+
  | user | date           | status |
  +----- +----------------+--------+
  |    1 | 12/01/2017     | open   |
  |    1 | 12/02/2017     | open   |
  |    1 | 12/03/2017     | open   |
  |    1 | 12/04/2017     | closed |
  |    1 | 12/05/2017     | closed |
  |    1 | 12/06/2017     | open   |
  |    1 | 12/07/2017     | open   |
  +------+----------------+--------+
  </code></pre>
  <p>Expected output:</p>
  <pre><code>+------+------------+----------------+-------- ----+------------+
  | user | status     | days_in_status | min         | max        |
  +----- +------------+----------------+-------------+------------+
  |    1 | open       | 3              | 12/01/2017  | 12/03/2017 |
  |    1 | closed     | 2              | 12/04/2017  | 12/05/2017 |
  |    1 | open       | 2              | 12/06/2017  | 12/07/2017 |
  +------+------ -----+----------------+-------------+-- ---------+
  </code></pre>