powerpivot 将两个 DB 的结果合并为一个 table

powerpivot results from two DBs into a single table

我有一个查询合并来自同一服务器上两个不同数据库的结果:

SELECT DISTINCT
        DB1.Table1.ProjectName ,
        CAST(DB1.Table1.ProjectFinishDate AS DATE) AS 'FinishDate' ,
        DB1.Table1.ProjectOwnerName AS 'ProjectOwner'
FROM    DB1.Table1 
WHERE   DATEDIFF(MONTH,CURRENT_TIMESTAMP,DB1.Table1.ProjectFinishDate) < 7
        AND DB1.Table1.ProjectPercentCompleted < 100
UNION
SELECT DISTINCT
        DB2.Table1.ProjectName ,
        CAST(DB2.Table1.ProjectFinishDate AS DATE) AS 'FinishDate' ,
        DB2.Table1.ProjectOwnerName AS 'ProjectOwner'
FROM    DB2.Table1 
WHERE   DATEDIFF(MONTH,CURRENT_TIMESTAMP,DB2.Table1.ProjectFinishDate) < 7
        AND DB2.Table1.ProjectPercentCompleted < 100
ORDER BY CAST(Table1.ProjectFinishDate AS DATE)

查询在 SQL 中运行良好,但我需要在 Excel 中将结果作为单个 table 显示。但是,因为它位于两个不同的数据库中,所以我无法将其用作单个数据连接的输出。我正在尝试将输出拉入 PowerPivot,因为它似乎应该允许我这样做,但我也无法让它在那里工作。

谁能告诉我是否有办法做到这一点?

谢谢。

希望这对您有所帮助!

Combining Data from Multiple Relational Data Sources into One Table in PowerPivot for Excel