Command for incrementing datas?

Discussion in 'MySQL' started by gubak1, Jan 15, 2008.

  1. #1
    Hi!

    I want to increment a data in the mysql database periodicaly. How can I perform it?

    My ideas:

    
    UPDATE datatable SET Age=Age+1 where Name='MyName'
    
    Code (markup):
    or

    
    UPDATE datatable SET Age=increment where Name='MyName'
    
    Code (markup):
    Is any of them correct?
    If not please tell me a correct form?

    Thanks
     
    gubak1, Jan 15, 2008 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First one is the best if age is unknown to you and can easily be set on a loop to run through all applicable updates.
     
    AstarothSolutions, Jan 15, 2008 IP
  3. kendo1979

    kendo1979 Peon

    Messages:
    208
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you can do that in mysql.
     
    kendo1979, Jan 16, 2008 IP