title: SQL query for grouping monthly period ranges
body: <p>I'm having some trouble building a query that will group my items into monthly ranges according to whenever they exist in a month or not. I'm using PostgreSQL.</p>
  
  <p>For example I have a table with data as this:</p>
  
  <pre><code>Name    Period(text)
  Ana     2010/09
  Ana     2010/10
  Ana     2010/11
  Ana     2010/12
  Ana     2011/01
  Ana     2011/02
  Peter   2009/05
  Peter   2009/06
  Peter   2009/07
  Peter   2009/08
  Peter   2009/12
  Peter   2010/01
  Peter   2010/02
  Peter   2010/03
  John    2009/05
  John    2009/06
  John    2009/09
  John    2009/11
  John    2009/12
  </code></pre>
  
  <p>and I want the result query to be this:</p>
  
  <pre><code>Name    Start     End
  Ana     2010/09   2011/02
  Peter   2009/05   2009/08
  Peter   2009/12   2010/03
  John    2009/05   2009/06
  John    2009/09   2009/09
  John    2009/11   2009/12
  </code></pre>
  
  <p>Is there any way to achieve this?</p>