title: SQL Getting row number when the value is different from previous one, no matter whether the value shows before
body: <p>Hi I have a difficulty when creating count: the base table is</p>
  <pre><code>rownum product   
   1      coke  
   2      coke
   3      burger
   4      burger
   5      chocolate
   6      apple
   7      coke
   8      burger
  </code></pre>
  <p>I want the result like below, as long as the product is different than the previous one, the count add one. I trying to use dense_rank(), rank() function, but it's not what I want. Thank you<strong>strong text</strong></p>
  <pre><code>rownum product   
   1      coke 
   1      coke      
   2      burger     
   2      burger     
   3      chocolate  
   4      apple      
   5      coke       
   6      burger     
  </code></pre>