• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] SQL Update entry +1

Status
Not open for further replies.

yvoms

Exalted Member
Hey guys, i would like to know how to update the entry +1, and loop it till the last row.
So for example looping it; http://prntscr.com/8gzv5w

I would like to update the rows to 500001 + 1 and loop it, so it updates each row,
for example
500001, 500002, 500003, 500004, 500005,
 

Hyperion

Founder
Depending on what language you're using with the SQL query.. You would probably use a for loop

or else you can just update individually on one query eg: UPDATE table SET blah=value WHERE this=value, SET blah=value WHERE this=value2, SET blah=value, WHERE this=value3
etc
 

yvoms

Exalted Member
[MENTION=1024]Neccta[/MENTION] unfortunately that did not work, but yes that is what i am looking for hehe. [MENTION=2]Faded[/MENTION] i'm trying to update the entry row to start at 500.001 and then increase by 1 for all the rows in the table.
Doing it manually would take way to much time.


Set @entry 500001
Update entry + 1;

Wouldn't that work?
 
Last edited:

Grandelf

Esteemed Member
This should do the trick, this query will update the entry column of every record in the item template table.
The first record will have the entry of '@start_value' and it will then keep incrementing.

So basically what you said:
Set @entry 500001
Update entry + 1;

Code:
SET @START_VALUE = 500000;

UPDATE item_template SET entry = @START_VALUE := @START_VALUE+1;
 
Last edited:
Status
Not open for further replies.
Top