Quantcast
Channel: Increment all values in mysql table - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by echo_Me for Increment all values in mysql table

i think you are looking for something like that SET @bookid = 1; UPDATE books SET `id` =`id`+ @bookid ;your query wll always give id = 2

View Article



Answer by Walls for Increment all values in mysql table

Use this:ALTER TABLE books AUTO_INCREMENT=1;or if you haven't already id column, also add itALTER TABLE books ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT, ADD INDEX (id);

View Article

Increment all values in mysql table

Lets say I have +-------------+--------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------------+--------------+------+-----+---------+-------+| id | int(11) |...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images