Solved

Mass editing MySQL database

Posted on 2013-06-14
3
405 Views
Last Modified: 2013-06-19
What would be the proper way to edit a MySQL data table, replacing a value?  

I'm trying to, for instance, replace value "x" under 'post_type' with value "y" without possibly editing other columns.  

If that isn't possible (editing restricted to column) I would still like to know what the appropriate command is to run the REPLACE syntax on the entire table.
0
Comment
Question by:tbawarehouse
  • 2
3 Comments
 
LVL 4

Assisted Solution

by:Christopher Raymond Mendoza
Christopher Raymond Mendoza earned 500 total points
ID: 39247977
Hello tbawarehouse,

Try this:
    UPDATE `table1` SET `post_type`="y" WHERE `post_type`="x";

More on the UPDATE statement:
    http://dev.mysql.com/doc/refman/5.0/en/update.html

Regards,
0
 

Accepted Solution

by:
tbawarehouse earned 0 total points
ID: 39248239
Thanks for the response, however I found a much easier solution.

Using the MySQL Query Browser I simply enable editing then use the 'Search' function in the GUI to replace value "x" with value "y."  While it doesn't restrict to the post_type column, I was able to work around that small issue by using unique names for the fields I need.
0
 

Author Closing Comment

by:tbawarehouse
ID: 39258780
Found the obvious I didn't see before.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question