title: Mysql query to get records from a range of records
body: <p>I have the following table in my database,Now I want to fetch all records which start from one product value to the next product value.I mean all records starting from one 'product' to the next product value. 
  Updated:</p>
  
  <p>The Item_Type will always have two values either product or rule.So we have to find all the records starting from product value to the last rule value.  </p>
  
  <pre><code>id   Item_Type       Product_ID 
  1    product          512350       
  2    rule             541   
  3    rule             5431
  4    rule             5421  
  5    rule             5431  
  6    rule             5241
  7    product          5350  
  8    rule             5541   
  9    rule             5341
  10    rule             5421  
  11    rule             5141  
  12    rule             54411   
  13    product          51250   
  14    rule             541   
  15    rule             541
  16    rule             541  
  17    rule             541  
  18    rule             541 
  19    product          512350   
  20    rule             541   
  21    rule             541  
  </code></pre>
  
  <p>Please help me how it can done in mysql query.</p>