#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Brisbane, Australia
    Posts
    2
    Rep Power
    0

    Replace data using LEFT$() in mySQL DB


    Hi,

    I need to find the letters "ABC" in the 'name' field of my 'products' table and change the 'price' to a new price for all records that match the "ABC" criteria.

    i.e. IF LEFT$(name,"ABC") then set price = '1.99';

    Can someone show me how to do this, please.

    Thank you.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2008
    Posts
    1,927
    Rep Power
    378
    Code:
    UPDATE my_table SET my_value = 1.99 WHERE my_string LIKE 'ABC%';
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Brisbane, Australia
    Posts
    2
    Rep Power
    0
    Originally Posted by cafelatte
    Code:
    UPDATE my_table SET my_value = 1.99 WHERE my_string LIKE 'ABC%';
    Thanks very much CafeLatte. Much appreciated.

IMN logo majestic logo threadwatch logo seochat tools logo