title: MySQL update a field with an incrementing variable
body: <p>I have a table named 'textile_events' in one of my databases.</p>
  
  <pre><code>mysql&gt; describe textile_events;
  
  +-------------+--------------+-----+---------+----------------+
  | Field       | Type         | Key | Default | Extra          |
  +-------------+--------------+-----+---------+----------------+
  | id          | int(11)      | PRI | NULL    | auto_increment |
  | token       | varchar(20)  |     | NULL    |                |
  | reg_time    | datetime     |     | NULL    |                |
  | eid         | varchar(20)  |     | NULL    |                |
  | fname       | varchar(20)  |     | NULL    |                |
  | lname       | varchar(20)  |     | NULL    |                |
  | paid        | varchar(10)  |     | NULL    |                |
  | seq_no      | int(11)      |     | NULL    |                |
  +-------------+--------------+-----+---------+----------------+
  8 rows in set (0.00 sec)
  
  mysql&gt; select count(*) from textile_events;
  
  +----------+
  | count(*) |
  +----------+
  |     9325 |
  +----------+
  1 row in set (0.00 sec)
  
  mysql&gt; select count(*) from textile_events where eid = 'headsup' ;
  
  +----------+
  | count(*) |
  +----------+
  |     2553 |
  +----------+
  1 row in set (0.01 sec)
  </code></pre>
  
  <p>'seq_no' field was introduced to the above table yesterday.</p>
  
  <p>Now, I need to assign an incrementing number to 'seq_no' field for all 'headsup'
  events where paid field is equal to 'paid'.</p>
  
  <p>In other way, I am looking for something like this,</p>
  
  <pre><code>$i = 250
  while( true ):
      $i++
      UPDATE textile_events SET 'seq_no' = $i 
          WHERE eid = 'headsup' AND paid = 'paid'
  endwhile;
  </code></pre>
  
  <p><em>How do I assign an incrementing number to a newly introduced field only to recods
  that satify a given condition?</em></p>
  
  <p><strong>What are the available options and what is the most efficient way to accomplish this?</strong></p>