table_1
-------------
| id | status|
-------------
| 1 | no |
-------------
| 2 | no |
-------------
| 3 | no |
-------------
| 4 | no |
-------------
| 5 | no |
-------------
table_2
------------------------
| id | a1 | b2 | ridx |
------------------------
| 1 | 5 | 0 | 1,2,3 |
------------------------
| 2 | 3 | 0 | 4,5 |
------------------------
我正在尝试创建一个触发器:
CREATE TRIGGER test1 AFTER UPDATE ON table_2
FOR EACH ROW
IF OLD.a1 = NEW.b2 THEN
UPDATE table_1 SET status = "OK" WHERE id IN (OLD.ridx);
END IF
我的触发器只将1个id更新为table_1中的状态OK
如何将table_1的所有状态从行ridx中的id更新为OK