Mysql commando help

Discussion in 'Databases' started by Lindkvist, Feb 27, 2012.

  1. #1
    I have a commando here

    update newsletters set status = 'sent' WHERE ID = 12345;

    I would like to have added to the update box nr_sent so it has the same numbers as it says in the box nr_to_send - is it possible in the same commando?
     
    Lindkvist, Feb 27, 2012 IP
  2. trendint

    trendint Peon

    Messages:
    52
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just to clarify; you have a table called newsletters that has the columns 'id', 'status', 'nr_sent' and 'nr_to_send' - you want to update the column of id 12345 so that status = 'sent' and nr_sent = the value of nr_to_send? If this is correct:

    
    UPDATE newsletter SET status = 'sent', nr_sent = nr_to_send WHERE id = 12345;
    
    Code (markup):
     
    trendint, Feb 29, 2012 IP
  3. Lindkvist

    Lindkvist Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks - I really like your help
     
    Lindkvist, Mar 1, 2012 IP