var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help Please. Trying to add 1 Year onto a Date.
Hey guys, I got a table called members and Im trying to set up a trigger to add 1 YEAR onto a DATE when someone adds a new record. The SQL Command I've been trying is:
I've been messing with this for two days, read the MySql documentation, search all over the net, no avail.
CREATE TRIGGER setResigned
BEFORE INSERT ON members
FOR EACH ROW
SET NEW:dateResigned = DATE_ADD(NEW:dateJoined,INTERVAL 1 YEAR);
Please help. Thanks.
Last edited by se7enhu; 06-11-09 at 20:56.
Originally Posted by se7enhu
Why do it in a trigger? they just make your application more complicated and hide functionality. Why not just do it in the original insert ie :
insert members ( ... , dateResigned )
values ( ..., date_add( now(), interval 1 year ) );
The other question is do people always resign after 1 year? If so then why store dateResigned, why not just calculate dateResigned from the date joined.