Mysql triggers are in the format of create trigger trigger_name after/before insert/update/delete on one_table for each row your_ SQL. The red part is named by yourself, and the blue part is a value. The black part is required, the final green part is the SQL statement you want to run. The update method for the two table join operations in mysql is (mysql does not use the join statement here): update A, B set. a2 = B. b2 where. a1 = B. b1 and B. b2 = "XXX" where A and B are the user-created table names a2 and b2 are the attribute values under the table; In www.2cto.com mysql, the trigger is used to obtain the newly inserted data keyword, that is, (I have bad naming habits for databases): table1: records (accountid, date, month, week, income, expend, remark); table2: Rweek (week, Wincome, wexpend); trigger to insert a group of data for table1, table2 summarizes the corresponding week values: create trigger t1 after insert on records for each row update Rweek set Rweek. wincome = Rweek. wincome + NEW. income, Rweek. wexpend = Rweek. wexpend + NEW. expend where Rweek. week = NEW. week; by Chanthon