title: Mysql, Check field value change?
body: <p>Mysql, Check field value change? if change the value then show different value</p>
  
  <p>table: a</p>
  
  <pre><code>   id  size  name
     --------------
     1   500   abc
     2   200   bcd
     3   400   xyz
     4   500   bbb
     5   200   aaa
  
  
    select @s:=@s+1 as index, id, size, name from a,(SELECT @s:= 0) AS s order by size;
  </code></pre>
  
  <p>In this query data like.</p>
  
  <pre><code>   index id  size  name
     --------------------
  
     1     2   200   bcd
     2     5   200   aaa
     3     3   400   xyz
     4     1   500   abc
     5     4   500   bbb
  </code></pre>
  
  <p>I need to get index change when size is change.
  I want to get this type of data. like.</p>
  
  <pre><code>   index id  size  name
     --------------------
  
     1     2   200   bcd
     1     5   200   aaa
     2     3   400   xyz
     3     1   500   abc
     3     4   500   bbb
  </code></pre>