CREATE TRIGGER CHANGE1 ON 车票 FOR INSERT AS BEGIN UPDATE 火车 SET NEW.剩余票数=(SELECT 剩余票数 FROM 火车 WHERE 火车.车次='(SELECT 车次 FROM INSERTED)')-1 WHERE 火车.车次='(SELECT 车次 FROM INSERTED)' END; 求解哪里出问题 它警告说缺少ALTER BEFORE INSTEAD OF语句 我们没学到 但是我想学一下 求大神!
CREATE TRIGGER CHANGE1 AFTER INSERT ON 车票 FOR EACH ROW BEGIN UPDATE 火车 SET NEW.剩余票数=(SELECT 剩余票数 FROM 火车 WHERE 火车.车次='(SELECT 车次 FROM 车票.INSERTED)')-1 WHERE 火车.车次='(SELECT 车次 FROM 车票.INSERTED)' END;