Auto increment in select statement


/ Published in: MySQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SET @rank=0;
  2.  
  3. core_objective_sub_items,
  4. (select objective_ptr_id, @rank:=@rank+1 AS rank from core_task) as one
  5. core_objective_sub_items.to_objective_id=one.objective_ptr_id
  6. one.rank = core_objective_sub_items.id;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.