sql According to one field plus or minus 7 days into another date field

Plus 7 days

Date field = DATE_ADD (fixed date field, INTERVAL UPDATE SET modified table . 7 DAY) the WHERE condition ~~~

 UPDATE 表名 SET cretime=DATE_ADD(decdate,INTERVAL 7 DAY) WHERE 条件~~~~

 cretime as being modified fields, decdate queried for the time field plus 7 days time field into cretime

Save 7 days

- date field = DATE_ADD (fixed date field, INTERVAL UPDATE SET modified table . 7 the WHERE condition DAY ~~~) 
the UPDATE table cretime SET = DATE_ADD (decdate, the INTERVAL - . 7 DAY) the WHERE condition ~~~~ 
cretime as being modified field, decdate queried for the time field minus 7 days time field into cretime

 

Guess you like

Origin www.cnblogs.com/yanchaohui/p/11904256.html