title: Group data by the change of grouping column value in order
body: <p>With the following data</p>
  
  <pre><code>create table #ph (product int, [date] date, price int)
  insert into #ph select 1, '20120101', 1
  insert into #ph select 1, '20120102', 1
  insert into #ph select 1, '20120103', 1
  insert into #ph select 1, '20120104', 1
  insert into #ph select 1, '20120105', 2
  insert into #ph select 1, '20120106', 2
  insert into #ph select 1, '20120107', 2
  insert into #ph select 1, '20120108', 2
  insert into #ph select 1, '20120109', 1
  insert into #ph select 1, '20120110', 1
  insert into #ph select 1, '20120111', 1
  insert into #ph select 1, '20120112', 1
  </code></pre>
  
  <p>I would like to produce the following output:</p>
  
  <pre><code>product | date_from | date_to  | price
    1     | 20120101  | 20120105 |   1
    1     | 20120105  | 20120109 |   2
    1     | 20120109  | 20120112 |   1
  </code></pre>
  
  <p>If I group by price and show the max and min date then I will get the following which is not what I want (see the over lapping of dates).</p>
  
  <pre><code>product | date_from | date_to  | price
    1     | 20120101  | 20120112 |   1
    1     | 20120105  | 20120108 |   2
  </code></pre>
  
  <p>So essentially what I'm looking to do is group by the step change in data based on group columns product and price. </p>
  
  <p>What is the cleanest way to achieve this?</p>