Urgent help Find Replace Query

Discussion in 'MySQL' started by rajivv, Jun 21, 2010.

  1. #1
    HI,
    Have use find and replace simple query before but for this need help

    Table name - TM
    field 1= title
    field 2= cat
    field 3= subcat

    Want to find and replace all entries with subcat = 13 to 14 where field 1 title has keyword faucet and where field 2 cat = 18

    Please help
     
    rajivv, Jun 21, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    UPDATE my_table
    SET `field 3` = 14
    WHERE
    `field 1`LIKE '%faucet%'
    AND `field 2`= 18
    AND `field 3` = 13;

    I would defintely do a backup first. Are the column names filed 1, filed 2 etc... or are they title, cat, subcat?
     
    jestep, Jun 21, 2010 IP
  3. rajivv

    rajivv Peon

    Messages:
    335
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    field names in table are tilte,cat etc !!! is above ok to do
     
    rajivv, Jun 21, 2010 IP
  4. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #4
    You would change it to something like this then:

    UPDATE my_table
    SET subcat = 14
    WHERE
    title LIKE '%faucet%'
    AND cat = 18
    AND subcat = 13;
     
    jestep, Jun 21, 2010 IP
  5. rajivv

    rajivv Peon

    Messages:
    335
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks let me try the same in phpmyadmin sql query thanks again will let you progress
     
    rajivv, Jun 21, 2010 IP