SQL question

Proximity

IDK?
Feb 13, 2014
673
56
oPZ74S2.png

How would I change the first column to change from 17560 to 1 than 17561 to 2 etc
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
I'm assuming the row's name is ID?
Code:
ALTER TABLE `table` DROP `id`;
ALTER TABLE `table` AUTO_INCREMENT=1;
ALTER TABLE `table` ADD `id`int AUTO_INCREMENT;
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
I'm assuming the row's name is ID?
Code:
ALTER TABLE `table` DROP `id`;
ALTER TABLE `table` AUTO_INCREMENT=1;
ALTER TABLE `table` ADD `id`int AUTO_INCREMENT;
the code hasn't been inserted, I'm guessing he's adding items to the table which already have that ID. I think he's just being lazy and wants a script to do it for him lol
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
the

The code hasn't been inserted, I'm guessing he's adding items to the table which already have that ID. I think he's just being lazy and wants a script to do it for him lol
From what the looks of it, they deleted the columns instead of truncating the table so it started at ID 17,000 and he just wanted to reset the ID's.
Code:
ALTER TABLE `TABLE` AUTO_INCREMENT =1
Make sure you truncate the table next time, not delete.
Code:
TRUNCATE TABLE `TABLE`
 

Users who are viewing this thread

Top