If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Advice on using Update/Replace/Where?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-06, 08:38
ripthesystem ripthesystem is offline
Registered User
 
Join Date: Feb 2006
Posts: 2
Question Advice on using Update/Replace/Where?

OK I have an OScommerce site based on MySQL up and running with ~2500 products in the store. However now it turns out that approximately 600 products got put into the store with the wrong product descriptions.

What I want to do is, via MySQL, issue a series of SQL commands to find ONLY these 600 products and replace part of their wrong description with part of the corrected description.

Basically what I have come up with is:


Quote:
UPDATE products_description SET products_description = replace(products_description, 'OLD DESCRIPTION', 'NEW DESCRIPTION') WHERE products_name = 'Custom Product1';

My hope was that with this line I could UPDATE the table products_description in the column products_description and replace the OLD DESCRIPTION with the NEW DESCRIPTION but only where the products_name was Custom Product1

The syntax was fine and SQL accepted it. However it changed the part of the product description for EVERY SINGLE product in my store. That's no big deal as I can change it back to how it was before but I need to know what SQL command to use to get it to do exactly what I want.


Any ideas? Thanks!
Reply With Quote
  #2 (permalink)  
Old 02-09-06, 08:51
ripthesystem ripthesystem is offline
Registered User
 
Join Date: Feb 2006
Posts: 2
n/m the above statement does work. Don't know what kinda crack I was on yesterday when I thought it didn't.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On