title: Query to get count of items with a given status within a given timeframe
body: <p>An interesting SQL problem has recently come up at work, one which I haven't been able to solve without multiple steps in the past.</p>
  
  <p>Say you have a simple "ItemStatus" table, which exists to keep track of the status of different items. Columns are "itemId", "date status changed", and "status". Example:</p>
  
  <pre><code>ItemId      DateStatusChanged    Status
  1           09/01/2016             New
  1           10/15/2016             Complete
  2           10/20/2016             New
  2           10/25/2016             Complete
  </code></pre>
  
  <p>An item is assumed to be the same status until it is changed. So item 1 was "New" starting 9/1, and remained "New" until 10/15, when it changed to "Complete". Item 2 was "New" from 10/20 to 10/25.</p>
  
  <p>So say you want to query the table to get a count of how many unique items had a status of "New" anytime within October 2016 (which in this case would be "2"). Is there a single SQL query that can return this result?</p>