Update all columns

Discussion in 'MySQL' started by xSaimex, Feb 1, 2009.

  1. #1
    I'm rather new to MySQL. But I know some stuff. I need some help though.. Basically, I have a database, for example
    DB: site
    Table: category
    Column: 1,value,3

    So as you can see I tagged the value in bold. What I need help with is, how do I update the columns, so I can replace all the value in it with a new one, yes, I want to update/replace all the current data with the one I want to.

    I'm sorry for my English, not my first language. And sorry if I didn't explain it very well, if you need help to, please post here, I'll try to explain more specifically.
     
    xSaimex, Feb 1, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    update category set value = 'value' where id = '1'
     
    crivion, Feb 1, 2009 IP
  3. xSaimex

    xSaimex Peon

    Messages:
    88
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah I know that. But the thing is, I want to update the value for all of them. For example, I have a 3 category's, let's name them:
    a
    b
    c

    in a I got "hi" , in b I got "sup" , in c I got "dude". So what I want to do is, I want to replace hi,sup,dude with for example "123". You know what I mean?
     
    xSaimex, Feb 1, 2009 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    huh? you want to update each record with the same text string?
     
    shallowink, Feb 1, 2009 IP
  5. xSaimex

    xSaimex Peon

    Messages:
    88
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah. It's not exactly a category thing. Just giving some examples.
     
    xSaimex, Feb 1, 2009 IP
  6. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #6
    just remove the where id = '1' sentence
    update category set fieldName = 'value'
     
    crivion, Feb 1, 2009 IP
  7. xSaimex

    xSaimex Peon

    Messages:
    88
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thank you so much crivion!!!
     
    xSaimex, Feb 1, 2009 IP