简体   繁体   English

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

[英]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.

相关问题 SQL触发器,用于将值从表A-列A复制到表B-列A IF值在表B中是唯一的 - SQL Trigger to copy value from Table A - Column A to Table B - Column A IF Value is unique in Table B SQL:将表 B 中的列添加到表 A - SQL: Adding column from table B to table A 从表B到表A的MySQL更新列 - MySQL update column from table B to table A 如果表A中的列A与表B中的列B相等,则从两个表(表A和b)中获取输出 - get output from two tables(table A and b) if column A from table A is equal to column B from Table B SQL将A表a列的值复制到B表b列中 - SQL copy values of column a of table A into column b of table B 如果列表包含表b另一列的子字符串,则用表b的列值更新列表 - update column table with value of column from table b if it contains substring from another column from table b 将表A的所有列与表B的列连接起来进行检索 - Join retrieve, all column of table A with a column from Table B 如何使用来自表 B 列 3 Teradata 的输入更新表 A 列 3 - How to Update Table A column 3 with input from Table B column 3 Teradata 比较表 A 中一列和表 B 中另一列的值 - Compare values from one column in table A and another column in table B 如果'table a'。'column b'与'table b'。'column a'相匹配,如何用'table b'。'column b'替换'table a'。'column b' - how to replace 'table a'.'column b' with 'table b'.'column b' if 'table a'.'column b' matches 'table b'.'column a'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM