[英]Copy Column A from Table 1 and column B from Table 2 into Table 3 columns A and B
I have table 3, with columns A and B. I want to do an insert, where A is a column I will copy from table 1, and B is a column from table 2.我有表 3,有 A 列和 B 列。我想做一个插入,其中 A 是我将从表 1 中复制的列,B 是表 2 中的一列。
What I know works:我所知道的有效:
INSERT INTO TABLE3(A)
SELECT A
FROM TABLE1
What I want:我想要的是:
INSERT INTO TABLE3(A, B)
SELECT A
FROM TABLE1
SELECT B
FROM TABLE2
Do you want every combination of A and B?你想要 A 和 B 的所有组合吗? In that case:在这种情况下:
INSERT INTO TABLE3 (A, B)
SELECT TABLE1.A, TABLE2.B
FROM TABLE1, TABLE2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.