简体   繁体   English

从一个表到另一个表插入数据不起作用

[英]Insert data from one to another table is not working

I have two mysql table t1 & t2 我有两个mysql表t1和t2

t1 has one field called 'name' t1有一个名为'name'的字段

' t2 has two field called 'name' and 'date', where 'date' field set as current timestamp in default 't2有两个名为'name'和'date'的字段,其中'date'字段默认设置为当前时间戳

I need to import all data from t1 to t2 我需要将所有数据从t1导入到t2

INSERT into T2 SELECT * FROM t1 插入T2 SELECT * FROM t1

query is not working, its saying that count of fields are not same 查询不起作用,它说字段数不一样

How can i modify this query? 我该如何修改此查询?

INSERT INTO t2(NAME)SELECT名称FROM t1

Insert into t2 select name from t1 从t1插入t2选择名称

Try and let me know 试试让我知道

插入到t2(名称)(从t1中选择名称)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM