问题
I am fairly new to ssrs r2 2008. What I am trying to do is create a funnel chart which displays the combined revenue information from two tables in different databases but on the same server. Doing my own research, I have found that I could use the lookup function, but I am not sure where I would implement this function. I have done research, but I haven't found any documentation which explicitly explains how and where lookup can be implemented.
What I have so far is two datasources which reference each database, and two datasets with each dataset referencing each datasource. Both datasets have the same field names as the tables in the database have the same fields, so I can basically perform the lookup on any field.
Any help would be greatly appreciated. Thanks in advance!
回答1:
You'll need to UNION
the rows from each table together. Since you are going across databases, you need to include the database name in the table reference for the table that the dataset's data source isn't connected to:
SELECT Field1, Field2, Field3
FROM MyTable
UNION ALL
SELECT Field1, Field2, Field3
FROM OtherDatabase.dbo.OtherTable
You need to make sure that the account that the report is running under has access to both databases.
来源:https://stackoverflow.com/questions/26360641/combining-the-information-from-two-datasets-in-ssrs-r2-2008