开发者

Copy rows from one table to another in MySQL

开发者 https://www.devze.com 2022-12-29 21:57 出处:网络
I have two tables with the same structure. I need to select data from one table and have to store them i开发者_C百科nto the other.

I have two tables with the same structure. I need to select data from one table and have to store them i开发者_C百科nto the other.

How can I do that?


insert into tablea(id,name) select id,name from tableb;


Since they are the same structure then you can just do


insert into table1 select colum1, column2,... from table2


insert into blacklist 
select * 
from newblacklist

for uploading any single number

insert into blacklist 
select * 
from newblacklist 
where numbers ='123456'


leave out the values keyword

insert into tbl1 
select * from tbl2
0

精彩评论

暂无评论...
验证码 换一张
取 消