mysql - change date - update table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dragrid
    New Member
    • Jan 2009
    • 29

    mysql - change date - update table

    Hi Anyone appreciate your help,

    I have a table with about 7 columns - one is a date column - I would like to update the table and change all dates starting from a certain key (the first column) from May to June - keeping the year and date just changing the month 05 to 06
    note the dates are in random order -so e.g start at id 1001
    col 1 (id#) col2(dates) note date format
    1001 2010-05-14
    1002 2010-05-08
    1003 2010-05-30
    want to get
    1001 2010-06-14
    1002 2010-06-08
    1003 2010-06-30

    Thanks
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    Something like this might work:
    Code:
    UPDATE database.table SET datecol = (datecol + INTERVAL 1 MONTH) WHERE id = 1001

    Comment

    • dragrid
      New Member
      • Jan 2009
      • 29

      #3
      That did it - thanks a lot

      Comment

      Working...