Posted By

kat on 03/11/11


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

meinmotion
jeremydouglass


Auto increment in select statement


 / Published in: MySQL
 

  1. SET @rank=0;
  2.  
  3. UPDATE
  4. core_objective_sub_items,
  5. (SELECT objective_ptr_id, @rank:=@rank+1 AS rank FROM core_task) as one
  6. SET
  7. core_objective_sub_items.to_objective_id=one.objective_ptr_id
  8. WHERE
  9. one.rank = core_objective_sub_items.id;

Report this snippet  

You need to login to post a comment.