开发者

Insert Query for table

开发者 https://www.devze.com 2022-12-27 10:52 出处:网络
How to add data from one table to another table with new data in SQ开发者_如何学CL?You\'d use an SQL INSERT INTO SELECT like so:

How to add data from one table to another table with new data in SQ开发者_如何学CL?


You'd use an SQL INSERT INTO SELECT like so:

INSERT INTO "table1" ("column1", "column2", ...)
SELECT "column3", "column4", ...
FROM "table2"

You can find more info here: http://www.1keydata.com/sql/sqlinsert.html


Don't have enough points to comment, but lomaxx's query is functioning correctly @shanks. If you run an insert query again, you will get duplicates for each time the query is run.


INSERT INTO "table1" ("column1", "column2", ...)
SELECT "column3", "column4", ...
FROM "table2"
minus
SELECT "column1", "column2", ...
FROM "table1"

0

精彩评论

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