将多个级别的数据从一个表组合到另一个表

时间:2017-03-28 12:40:28

标签: sql excel-vba vba excel

我在sheet1中有以下表格。

Project| Resource Name | Line Manager
----------------------------------

2345    David          Peter
2345    Tam        Peter
2345    Richard        Peter
2358    Russell        Adam

Sheet2有下表

Project| Month |Revenue
-----------------------

2345    Jan 10000
2345    Feb 15000
2358    Jan 8000
2358    Feb 12000

如何在sheet2中获得以下结果

Project| Month| Revenue| Resource|Name Line Manager
------------------------------------------------

2345    Jan 10000   David   Peter
2345    Jan 10000   Tam Peter
2345    Jan 10000   Richard Peter
2345    Feb 15000   David   Peter
2345    Feb 15000   Tam Peter
2345    Feb 15000   Richard Peter
2358    Jan 8000    Russell Adam
2358    Feb 12000   Russell Adam

1 个答案:

答案 0 :(得分:1)

怎么样:

select s1.*, s2.* from sheet1 s1 join sheet2 s2 on s2.project=s1.project