Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pardon the ignorance -- can I query 2 databases for one report? 4

Status
Not open for further replies.
Jun 13, 2003
20
US
Could someone please tell me if it is possible to query 2 databases at the same time for one report? and if so, now can I access the second database in the Database Expert?

Thank you so much,

PrograMist
 
You can access 2 databases at once. Click on database, add database to report, and then browse to the data connection you want.

However this is not the same as a UNION query. If you want to do a UNION query this needs to be done on the database side as a view, then base your crystal report on the view.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
dgillz, thank you for your answer. Could you pelase elaborate on the Union query definition? I tried to search Crystal Reports help and could not find anything about Union queries... Thank you.
 
A Union Query is done in SQL. It is a way to select data from two databases or tables, and combine the data into a single table. If you have Crystal 9.0, you can create a SQL Command and use the resulting data in place of your two databases. A Union Query is especially useful if the links between your databases cause duplicate records in your report.

Roz
 
A Union can be done in previous versions of Crystal too.

As for querying to different databases, that isn't the same as a Union query, as a Union is for querying like structres.

To add in a second data source to a Crystal Report, just select Database->Add Database to Report and point at the new datasource.

This is version dependent, and you will likely find join limitations depending upon what it is that you're adding in.

-k
 
Thank you, synapsevampire. I may come back to you all with more questions, as I start working on such queries... I appreciate the help of every one who responded to my question.

PrograMist
 
In Crystal 8.5 when creating a report, where would the SQL Union command be written. In report expert when choosing SQL Queries a repository opens. How would I get the query file into the repository?

Thanks
 
mrquest: Consider starting new threads when a topic is a few days old, you'll get faster and more responses.

To create a union query in 8.5, edit the Database->Show SQL Query

For instance you can copy the existing query and add the term UNION at the end, and then paste in that same SQL afterwards and make changes to it for a Union.

-k
 
If you are using the Union operator its best to create the query in Crystal SQL Designer that comes with Crystal Reports. There are many considerations when using Union and I would recommend reading through the definition first.
Once you create the qry object in the Crystal SQL Designer then open Crystal Reports and base the report on your query.
 
mrquest, synapsevampire, roswald

actually, THANK YOU all for continuing this thread -- I am very interested in your suggestions.... mrquest -- good question! very helpful to me as well...

PrograMist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top