Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Question Unanswered: 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:


    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!

  2. #2
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •