Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am running a MySQL, version 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0, database on one of our servers. I would like to move a group of similar entries in one set of fields to another set, and subsequently replace the data that was moved from the original group of fields with another set of similar information.
Is this possible, and if so, what would be the correct syntax to use? Thanks.
MySQL has quite esoteric possibilities like this one (just a modified OSC sample for a select statement):
Code:
select cd.categories_name, c.categories_image, cd.categories_htc_title_tag, cd.categories_htc_description from table_categories c, table_categories_description cd where c.categories_id = '999' and cd.categories_id = '777' and cd.language_id = '666';
Note the fragile mix of multiple tables and fields in a single statement.
If you really want to make all changes within a single SQL statement, then you better wade through MySQL documentation and prepare for a lot of testing. Within in PHP or C/C++ code you better break down the procedure into multiple queries - makes it easier to maintain.
Thanks for your reply. How about this: What command can I use to replace all instances of one data entry in a field with a new one. For example, if I want to replace all instances the tape ID 12345 in the 'local' field with that of 678910 in the same 'local' field, what command would I use? Thanks.
Not exactly sure this is how the table you are describing looks (your use of the word field is throwing me off), but if your tape ID is all that is in the field, it should be something similar to:
Code:
update local set tapeID = '678910' where tapeID = '12345';
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.