I have a table called "drupal_term_data" and a field in that table called "name". What I'd like is a query I can run that would remove the word "Tabs" from every record in that field. Can this be done?
Run your mySQL query to select the name field, and index field, of all the records. looping through all the records: Use preg_replace() www.php.net/preg-replace to remove "Tabs" UPDATE the field Caveats: How many records? Do you want to remove a space with the word? Does the table have an index or unique field? Michael
Sorry if I wasn't clear, I'm not totally sure of the terminology... I think I got it right now though. Inside the drupal_term_data table there is a column called "name", with 529 rows. Each row contains a string of text with the word "Tabs" on the end. I'd like to run an SQL query that can remove "Tabs" from each row (along with the space before it). The field "tid" is the primary key, "vid" is the index key. That should answer your questions too, drcode.
UPDATE drupal_term_data SET name = TRIM(TRAILING ' Tabs' FROM name); Code (SQL): It has been a long time since I did MySQL so cannot remember if you need to put markers around column names etc but I am sure you get the idea
No problem - have to say that far too many people argue how great MySQL is (and it is actually very good even if we use MS SQL or Oracle) but then dont know how to use 10% of its capabilities.