Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question SQL statement to modify all columns depending on their value

    hi, teh following SQL:
    Code:
    UPDATE `customer` SET `ServiceDate` = DATE_ADD('1900-01-01', INTERVAL 40812 DAY)
    updates all records in my table at the column ServiceDate with a date 40812 days after 1900-01-01

    My problem is is that each of the values in the ServiceDate column are not 40812, they are all different. 40812, 40965, 40723 and so on...

    Please help

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,312
    Thanks
    4
    Thanked 206 Times in 203 Posts
    Use the name of the column itself for the interval.

    Code:
    UPDATE `customer` SET `ServiceDate` = DATE_ADD('1900-01-01', INTERVAL `ServiceDate` DAY)
    Dave .... HostMonster for all of your hosting needs


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •