Jump to content
  • 0
Incognito

Duplicating items in My SQL

Question

I was wondering if there's a way to duplicate all weapons and armor in MySQL (workbench) (I can't seem to copy columns and rows together). I know there are commands, but I'm not familiar with them. Maybe someone could type the command out for me or give me a list to get me started.

 

I'm looking for something that.. copies all columns where item type = 4 or 5 in item_db to item_db2

and another that.. renames rows 1st#-nth# to mth#-sth# (n,m,s are just arbitrary numbers; n<m<s  and  sth# - mth# = nth# - 1st#)

 

Thanks

Edited by Incognito
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

INSERT INTO `item_db2`
    SELECT * FROM `item_db` WHERE `type` = 4 OR `type` = 5;

But I don't understand what you want to rename...

Link to comment
Share on other sites

Oh, I wanted to rename the rows in a column.

 

Say we had the column `id`:

 

id   ->   id

1    ->   1

3    ->   2

5    ->   3

2    ->   4

7    ->   5

 

I just used...

 

SET @cnt = 25000;
UPDATE `ragnarok`.`item_db2`
SET `id` = @cnt := (@cnt + 1)
WHERE `id`= 4;

 

 

and thanks!

Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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

By using this site, you agree to our Terms of Use and Privacy Policy.