In table1, I have 3 columns (let's say with columns Name, Age(which is already running on a trigger), Occupation). I want to copy only the 'Name' and 'Age' columns into another table 'table2'.
在table1中,我有3列(比如列名称,Age(已经在触发器上运行),Occupation)。我想只将'Name'和'Age'列复制到另一个表'table2'中。
I saw some previous posts on this topic, however I am not able to create a trigger in table2(not table1 cuz I already have a complicated trigger in there).
我在这个主题上看到了一些以前的帖子,但是我无法在table2中创建一个触发器(不是table1因为我已经有了一个复杂的触发器)。
I did the following:
我做了以下事情:
CREATE TRIGGER tg
AFTER INSERT ON table1
FOR EACH ROW
BEGIN
INSERT INTO table2 SET Name = NEW.Name, Age = NEW.Age;
END
1 个解决方案
#1
0
CREATE TRIGGER tg
AFTER INSERT ON table1
FOR EACH ROW
BEGIN
INSERT INTO table2 SET table2.Name = NEW.Name, table2.Age = NEW.Age;
END
Add table2. in front of column headings.
添加table2。在列标题前面。
#1
0
CREATE TRIGGER tg
AFTER INSERT ON table1
FOR EACH ROW
BEGIN
INSERT INTO table2 SET table2.Name = NEW.Name, table2.Age = NEW.Age;
END
Add table2. in front of column headings.
添加table2。在列标题前面。