I have three tables:
我有三张桌子:
- Table A has columns name, id, nationality
- Table B has a column name
- Table C has a column id
表A具有列名,ID,国籍
表B有一个列名
表C具有列id
I was wondering if it is possible to extract from Table A and insert its name column into Table B and id column into Table C in one single SQL query? Not in two separate queries.
我想知道是否有可能从表A中提取并在单个SQL查询中将其名称列插入表B和id列到表C中?不在两个单独的查询中。
I know it is possible in Oracle.
我知道在Oracle中有可能。
I am using Teradata, which supports all SQL queries.
我正在使用Teradata,它支持所有SQL查询。
1 个解决方案
#1
0
It is not possible to do in a single query. One table at a time only. Use a Transaction or a Stored statement to query the data and then two more queries to insert the data in each table. This does save you making the query for both inserts but you cant do an INSERT on two tables.
在单个查询中无法执行此操作。一次只有一张桌子。使用Transaction或Stored语句查询数据,然后使用另外两个查询在每个表中插入数据。这样可以节省您对两个插件进行查询,但是您无法对两个表执行INSERT。
#1
0
It is not possible to do in a single query. One table at a time only. Use a Transaction or a Stored statement to query the data and then two more queries to insert the data in each table. This does save you making the query for both inserts but you cant do an INSERT on two tables.
在单个查询中无法执行此操作。一次只有一张桌子。使用Transaction或Stored语句查询数据,然后使用另外两个查询在每个表中插入数据。这样可以节省您对两个插件进行查询,但是您无法对两个表执行INSERT。