如何插入表1到表2的数据?

时间:2021-11-26 09:18:17

Table table1 has got 500,000 rows. I want insert only 200,000 of them to table2 from table1, how do I do it?

表表1有50万行。我只想从表1中插入200,000个到表2,怎么做呢?

2 个解决方案

#1


3  

INSERT
INTO    table2
SELECT  *
FROM    table1
ORDER BY
        id -- or whatever
LIMIT 200000

#2


0  

INSERT INTO table2
SELECT **TOP 200000** * FROM table1 ORDER BY *<primary key>*

#1


3  

INSERT
INTO    table2
SELECT  *
FROM    table1
ORDER BY
        id -- or whatever
LIMIT 200000

#2


0  

INSERT INTO table2
SELECT **TOP 200000** * FROM table1 ORDER BY *<primary key>*