Reputation: 49
i want to update a filed named "outofdate"(type date : 2015-01-14 10:03:11 ) based on another filed name "lastmodification" . i want to add 10 days to "outofdate" field where :outofdate < NOW() (actual date)
My code is not working:
Update *
`mytable` set outofdate = lastmodification + 84500*10
WHERE outofdate < NOW( ) LIMIT 0,100
thx in advance!
Upvotes: 1
Views: 82
Reputation: 1271003
Update *
? That is not valid syntax. I think the rest is basically ok:
Update mytable
set outofdate = lastmodification + interval 10 day;
WHERE outofdate < NOW( )
LIMIT 0, 100;
Note that the number of seconds in a day is not 84,500. Also, for date/time data types, use date_add()
or interval
addition.
Upvotes: 1