如何将table1中的数据插入table2?

时间:2011-01-28 16:10:33

标签: mysql database

table1已有500,000行。我想从table2只向table1插入200,000个,我该怎么做?

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

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