Home > database >  Data is the primary key id number again
Data is the primary key id number again

Time:01-16

Now data 5687 is as follows:
Id name
Ts 1
2 ab
3 the at
4 ax
.

Other (not listed), a total of 14 field will now be renumbered all data, but is still id, according to the continuous since there are multiple results, one of the following:
Id name
1 ab
2 ax
3 ts
4 the at
Ask, how to do? In a word, is all data (collection of others) ordering up, break up to store,

CodePudding user response:

The create table newtable like oldtable

Insert into newtable (id, name... )
Select (@ a:=@ a + 1) as xh, t.n ame, t...
The from (select name,... The from oldtable order by rand (), the as t (select @ a:=0) as t1

  • Related