mysql set column equal to another automatic 1

mysql set column equal to another automatic

CREATE TRIGGER foobar AFTER UPDATE ON table
  FOR EACH ROW SET foo = foo + NEW.bar;

Here is what the above code is Doing:
1. Create a table called table with two columns, foo and bar.
2. Create a trigger that will run after an update on table.
3. For each row that is updated, set foo to be foo + bar.

Similar Posts