Solved

Mass editing MySQL database

Posted on 2013-06-14
3
408 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 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
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…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
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…

730 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