Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Mass editing MySQL database

Posted on 2013-06-14
3
Medium Priority
?
414 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

610 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