我试图让单元格Points_Per_Game
使用MySQL中的触发器来计算,不知道我错过了什么。
Points_Per_Game = Total_Points / Games Played,
DELIMITER $$
CREATE TRIGGER trg_Point_Per_Game
AFTER UPDATE ON Players
FOR EACH ROW
BEGIN
UPDATE Players SET Points_Per_Game = Total_Points / Games_Played;
END;$$
DELIMITER;
球员表:
+------------+--------------+--------------+-----------------+
| Name | Games_Played | Total_Points | Points_Per_Game |
+------------+--------------+--------------+-----------------+
| David | 0 | 0 | NULL |
| John | 6 | 7 | NULL |
Games_Played
和Total_Points
列每周都会通过bash脚本进行更新。
答案 0 :(得分:0)
你需要之前的更新触发器,你需要引用行中的数据:
(gdb) x/12cb $al
0x31: Cannot access memory at address 0x31