Mass Modify Database Values

Hi,

Please kindly take a look at this screenshot:

It shows some records in my website database
Im looking for an easy way to do the following

For eg:
I want to change all records under “user_login” to relevant record under “user_email” from ID 124 to ID 134 (or any no)

So if I take few examples from the screenshot:

Change “user_login” vihanga_vsm to vsontheflor2@gmail.com
Change “user_login” Umar to advertisimg@aicstudy.com
etc
also do this for from specific ID to specific ID
For eg: from ID 02 to 5400

Is there an easy way to do this? Any SQL query I can run?

Thanks

I would use an sql query to read the data and write it back into the different column.

Alternatively you could change your query to select user_email rather than user_login.

and maybe upload a picture with blurred out emails ?
don’t know if they are dummie email but still

I don’t know how to do it? Is it possible for you to let me know the exact SQL Query I can run? Thanks

First of all take a copy of your existing table which is quite easy using phpmyadin->operations->copy Table to…

As far as your data is concerned try searching for
MySql UPDATE table

Is there any SQL Query I can run?
This is kind of urgent and I don’t have time to research. Im trying to do this for last few days.

Thanks

Try searching google for mysql “copy column contents to another column” and there are quite a few results.
I could have copied the answers to here and made myself look clever :wink:

2 Likes

UPDATE daTable SET user_login = SUBSTRING_INDEX(user_email,'@',1) WHERE id BETWEEN 124 AND 134

Followed Rubble advise and found this query. Ran it and as far as I can see, it worked like I wanted
update wp_users
set user_login = user_email

Not sure if there are errors. Going to take a deeper look.

r937, thanks a lot for your advise too.

Really appreciate the help.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.