dmccabe Posted February 20, 2009 Share Posted February 20, 2009 i have asked this before I think, but it was a long time ago. i am creating a database for work and I need to create an audit trail of who did what. Is there anyway to set up triggers on a mySQL database so that when a field is update it captures certain information in to another table in the database? Quote Link to comment Share on other sites More sharing options...
Mchl Posted February 20, 2009 Share Posted February 20, 2009 http://dev.mysql.com/doc/refman/5.0/en/triggers.html Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 20, 2009 Share Posted February 20, 2009 i worked it out na na na lol. example from mchi link very nice! drop tables a,b; create table a(i int); create table b(n int default 0); insert into b values(0); create trigger ainsert before insert on a for each row update b set n=n+new.i; insert into a values(1); select * from b; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.