Jump to content

need help - odd php script - mysql update


carlosp

Recommended Posts

i need to create a script which update the mysql records

 

i have this table

ID                   CODE
1000                 abcd
1001                 abcd
1002                 abcd
1003                 abcd
1004                 abcd
.......
1049                 abcd
1050                 qwer
1051                 qwer
1052                 qwer
1053                 qwer
.......
1098                 qwer
1099                 qwer
1100                 38xs
......
17037                djaso
17038                djaso

i need to update only the IDs. There are like 25.000 rows in this table, the IDs are not all sequential (1,2,3,6...49,80,81...129,283,284...24800,24801...24810,25000) then the ID's will start from last ID+1 (25001)

 

each CODE is present in this table 50 times and the IDs corresponding to each code are sequential

 

How can i do that?

 

Thank you!

Edited by carlosp
Link to comment
Share on other sites

IDs are unique identifiers for rows within a table and their sequence should be of no relevance to your application. The application should work the same way even if these unique ids were generated randomly rather sequentially. Sometimes I wish they were so people wouldn't have hangups about gaps in id sequences.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.