?
Solved

Mass editing MySQL database

Posted on 2013-06-14
3
Medium Priority
?
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Assisted Solution

by:Christopher Raymond Mendoza
Christopher Raymond Mendoza earned 1500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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. …
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
Suggested Courses

752 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