如何将不同表中的多行插入一个表?

时间:2014-02-08 10:00:52

标签: sql select insert rows

我想插入不同的行,例如

SDESC from COMPANY
NAME from DISTRIBUTOR
WAREHOUSE from WAREHOUSE
SDESC from WAREHOUSE
LDESC from WAREHOUSE
STOCK_ALLOCATION from WAREHOUSE

到表STAGING_WAREHOUSE,其中包含以下列

COMPANY_NAME
DISTRIBUTOR
WAREHOUSE
SDESC
LDESC
STOCK_ALLOCATION

1 个答案:

答案 0 :(得分:0)

将数据插入相应的表格,然后创建视图STAGING_WAREHOUSE

创建视图

CREATE VIEW STAGING_WAREHOUSE AS
SELECT COMPANY.COMPANY_NAME, COMPANY.SDESC, DISTRIBUTOR.NAME, WAREHOUSE.WAREHOUSE, WAREHOUSE.SDESC, WAREHOUSE.LDESC, WAREHOUSE.STOCK_ALLOCATION
FROM COMPANY, DISTRIBUTOR, WAREHOUSE WHERE COMPANY.SDESC = WAREHOUSE.SDESC