将表1中的A列和表2中的B列复制到表3列A和B中

时间:2022-05-01 01:54:50

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

1 个解决方案

#1


0  

Do you want every combination of A and B? In that case:

你想要A和B的每一个组合吗?在这种情况下:

INSERT INTO TABLE3 (A, B)
SELECT TABLE1.A, TABLE2.B
FROM TABLE1, TABLE2

#1


0  

Do you want every combination of A and B? In that case:

你想要A和B的每一个组合吗?在这种情况下:

INSERT INTO TABLE3 (A, B)
SELECT TABLE1.A, TABLE2.B
FROM TABLE1, TABLE2