View Full Version : SQL statement to modify all columns depending on their value

08-04-2011, 02:25 PM
hi, teh following SQL:
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

08-05-2011, 09:54 AM
Use the name of the column itself for the interval.

UPDATE `customer` SET `ServiceDate` = DATE_ADD('1900-01-01', INTERVAL `ServiceDate` DAY)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum