mysql - Making two sql fields require each other to be updated before changing -
i'm new sql , i'm trying figure out how make can't update 1 of fields in table without updating 1 of other fields @ same time. think have expand current trigger , appreciate offered.
the database called employeeinfo , table called tblemployee
the fields in table follows:
employeeaddress | employeepostcode --------------------------------------- 15 green lane | s63 0no
apologies if formatting off. thanks.
you should reference new old.. not on mysql syntax like.
create trigger <trigger> before update on <table> each row begin if (new.<column> = old.<column> or new.<column2> = old.<column2>) <raise exception> end if; end;
Comments
Post a Comment