简体   繁体   English

如何将数据从表1插入表2?

[英]How do I insert data from table1 to table2?

Table table1 has got 500,000 rows. table1有500,000行。 I want insert only 200,000 of them to table2 from table1 , how do I do it? 我只想将其中的200,000个插入table2 table1 table2 ,该怎么做?

INSERT
INTO    table2
SELECT  *
FROM    table1
ORDER BY
        id -- or whatever
LIMIT 200000
INSERT INTO table2
SELECT **TOP 200000** * FROM table1 ORDER BY *<primary key>*

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

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