Number records with incrementing ID (add an ID column to an existing table)

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

Copy this code and paste it in your HTML
  1. SET @id := 0;
  2. UPDATE users SET id = (@id := @id + 1) WHERE id = 0;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.