Solved

SSRS 2008 Combine Two Data Sources in One Report

Posted on 2010-08-26
3
945 Views
Last Modified: 2012-06-27
Experts, I am trying to combine two data sets in one report that share a common ID called "Order". I have both data sets setup and the tablix in the report. One data source hold Date info about Projects and the other holds cost. The cost dataset is returning empty when I run it. Here is the code I'm using for it. I dont think I'm using the WHERE IN clause correctly. I'm not an SQL programmer so please dumb it down for me
SELECT     [Project ID], [Project Description], [Planning Order], [Order], [Shared/Specifc], AuthAmt, [Actuals to Date], FAC, [Rmng Fcst], [EOY Budget/Plan], 

                      [2010 YTD Actuals], [EOY Fcst]

FROM         EPMSAPExcel

WHERE     ([Order] IN ('" + Join(Parameters!OrderNumbers.Value, "', '")+"'))

Open in new window

0
Comment
Question by:hunew
3 Comments
 
LVL 16

Accepted Solution

by:
vdr1620 earned 500 total points
Comment Utility
I created a sample code for you below..Also, Suggest use to check the below links on SSRS - SQL Query with parameters and Joins in SQL ..which will help you re write your query correctly
 
http://www.sql-server-performance.com/articles/reporting/report_parameters_p2.aspx

http://www.codeproject.com/KB/database/SqlServerJoins.aspx
SELECT     [Project ID], [Project Description], [Planning Order], [Order], [Shared/Specifc], AuthAmt, [Actuals to Date], FAC, [Rmng Fcst], [EOY Budget/Plan], 

                      [2010 YTD Actuals], [EOY Fcst]

FROM         EPMSAPExcel E 

INNER JOIN TAble B        -----( Replace it with your tableName) 

ON E.order = B.Order      -- (Joining on matching columns)

WHERE     (E.[Order] IN (@Parameter)

Open in new window

0
 

Author Comment

by:hunew
Comment Utility
Thanks but the Table B you mention above is a different dataset in my case. how I can refer to it?
0
 
LVL 26

Expert Comment

by:Chris Luttrell
Comment Utility
I am afraid you cannot join the data from two separate datasets inside of RS, you will have to do that at the database level via your original query or stored procedure.  You can nest objects in RS or create subreports where the inner object uses a value from the outer object as a parameter to gather data to display, but it is nested something like this not Joined.

Customer 1    Name     Address
Some other customer 1 summary data
       Customer 1 Order Data
       Date        Quantity           Price
       1/1/10     100               $500.00
       2/2/10     300             $1250.00
Customer 2    Name     Address
Some other customer 2 summary data
       Customer 2 Order Data
       Date        Quantity           Price
       2/1/10     50                $500.00
       2/2/10     100             $1250.00
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now