Showing results for 
Search instead for 
Did you mean: 

Main Report from DB A and Subreport from DB B

Former Member
0 Kudos

I have a main report that gets the count of ProviderID's from DB A based on a parameter and a subreport that uses the same parameter that gets the count of ProviderID's from DB B. Both databases are on the same server.

The last requirement is a subreport (count) of the number ProviderID's that match in both databases. I was hoping to use a shared variable, but that's not working. I'm pretty illiterate when it comes to writing an SQL statement, so I was hoping there was another workaround. From what I'v read on the forum a UNION statement(?) is required if the db's are on separate servers, but these are on the same server and I'm using them in one CR report.

Any help would be invaluable.

View Entire Topic
Former Member
0 Kudos

You can consider using Array.

FYI, you do not need to be a 3 differnt server for writing SQL statement with union.

What you need to make sure the the same number of columns and each colums of 3 different databases are the same type.


DB-1 has columns Invoice no, Invoice Date, customer Code

DB-2 has columns Credit no, Credit Date, Customer code.

You are only interested in Document number and document date.

So, you do:

Select InvoiceNo, invoiceDate from DB-1

union all

Select CreditNo, CreditDate from DB-1