简体   繁体   中英

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.

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? In that case:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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