Re: Way OT MySql Update
| From: | John W. Holmes | Date: | Thu, 06 May 2004 12:22:21 +0000 |
| Subject: | Re: Way OT MySql Update | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185519@lists.php.net to get a copy of this message | ||
From: "Dave Carrera" <dave@ephgroup.com>
> I have a date column and have added a datenew column and want to do a
table
> wide update to make datenew 1 year more that date.
UPDATE yourtable SET datenew = dateorig + INTERVAL 1 YEAR;
Although... if "datenew" is always one year more than "dateorig", why would
you need another column?
SELECT dateorig, dateorig + INTERVAL 1 YEAR AS datenew, ... FROM ...
??
---John Holmes...