Reputation: 153
I have a field in my table in SQL with the next format:
2013-09-20 10:12:08
I want to update this field to X
days ago. for example, I want to update this field to 5 days ago, and it will be:
2013-09-15 10:12:08
There is SQL command for this?
Upvotes: 1
Views: 36
Reputation: 263723
UPDATE tableName
SET dateColumn = dateColumn - INTERVAL 5 DAY
-- WHERE codition here
In MySQL, you can use DATE_ADD() but can be express using INTERVAL
with +
and -
operator.
Upvotes: 1