2013-05-08 45 views
0
delimiter $$ 
CREATE TRIGGER after_status_added 
AFTER INSERT ON user_status 
FOR EACH ROW 
BEGIN 

    INSERT INTO all_post_status 
      values(new.status_id,new.friend_id,new.status_time_date, ABC); 
END$$ 
DELIMITER ; 

现在我想在all_post_status表的字段“user_type”中插入值'abc'作为值。如何做到这一点如何使用触发器从表1到表2的其他值插入新值

回答

0

插入触发器中有NEW - 它是新插入的记录。

http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html

+0

didnt从那里得到了答案,我在表post_status_value即USER_TYPE这是不存在的旧表中的额外字段。现在我想插入'restricted'作为字段user_type中的值以及其他值我如何做到这一点... – 2013-05-08 14:54:04

+0

INSERT INTO post_status_value SET user_type ='restricted''? – wroniasty 2013-05-08 15:08:31

+0

它不起作用 – 2013-05-08 15:36:14

相关问题