Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Combine 2 DB's Post Reply Post New Topic
Author Message
bluetenth
Newbie
Newbie


Joined: 16 Nov 2007
Online Status: Offline
Posts: 2
Quote bluetenth Replybullet Topic: Combine 2 DB's
     Posted: 16 Nov 2007 at 11:33am
I need to combine 2 databases (small) one for Spring and one for Fall student records.

The new Report has to count  the Spring and Fall students and if they attended both Semesters then that value Full Year needs to be calculated as well.


ex.  report output needed

Student Name       Spring   Fall      Full Year

Mr XYZ                     yes      yes      yes
Ms. ABC                    yes     no         no


totals                        2         1            1
BlueTenth NYC
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 19 Nov 2007 at 9:47am
What kind of database are you using?  That can be very important to what kinds of options are available to you.

I don't think Crystal can connect to two different databases simultaneously.  You can do this sort of thing with subreports.  But, that would make calculating your "Full Year" value extremely tricky.

Your best bet is to solve this problem on the data source side.  There are a few options.  Some databases will allow you to do a union or full outer join query, using base tables from two different databases.  You may need to export information into an Excel spreadsheet, or another database, and work with it there. 

Of course, as a professional developer, I can also tell you that maintaining different entire databases for each semester is poor overall design.  It will cause you no end of headaches in the long run.  I would highly recommend adding a column to each of your key tables to indicate which semester it belongs to, and then combine the databases.  But, I do understand that that sort of redesign is not always feasible.


IP IP Logged
bluetenth
Newbie
Newbie


Joined: 16 Nov 2007
Online Status: Offline
Posts: 2
Quote bluetenth Replybullet Posted: 20 Nov 2007 at 10:04am
It's an MS Access DB

Maybe theres a Query I can run to do this. What do you think? Any Ideas?
BlueTenth NYC
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 21 Nov 2007 at 5:09am
Yes.  You can create a query in Access that will reference another database.

Perhaps a better option, though, is to create a third Access database.  In that database, create linked tables to each of your previous databases.  (Creating linked tables is a considerably easier and more foolproof function that trying to reference another database in a query.)  Among other things, this will allow you to intelligently alias your tables (e.g., Spring_Enroll, Fall_Enroll), so you can keep up with what you are doing.

Then you can create a number of queries, combining the data any way you want.

(I do want to throw out another plea for redesign, though.  Note that, if you want to combine three semesters of data, you have to add in the linked tables of the third database, and redesign all of your queries.  Doing the above will get you a quick solution for now.  But, I recommend that you also take some time to redesign the database from scratch.)


IP IP Logged
wattsjr
Groupie
Groupie
Avatar

Joined: 25 Jun 2007
Location: United States
Online Status: Offline
Posts: 51
Quote wattsjr Replybullet Posted: 21 Nov 2007 at 8:03am
Hi bluetenth,
 
This may be a stupid question but, are you talking about 2 actual databases in separate .mdb files?  Or are you talking about two tables in 1 database .mdb file?
 
Regards,


Edited by wattsjr - 21 Nov 2007 at 8:04am
-jrw
IP IP Logged
IdoMillet
Groupie
Groupie


Joined: 26 Oct 2007
Location: United States
Online Status: Offline
Posts: 99
Quote IdoMillet Replybullet Posted: 21 Nov 2007 at 4:09pm
Use an Access UNION ALL query to combine the two data sets into a single data set.  Then, use that query as the data source in your Crystal report. 

By the way, Crystal can connect to 2 data sources.  The only restriction is that a join is limited to a single field in such a case.

- Ido
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
www.MilletSoftware.com
IP IP Logged
fejjarific
Newbie
Newbie
Avatar

Joined: 01 May 2009
Location: United States
Online Status: Offline
Posts: 1
Quote fejjarific Replybullet Posted: 01 May 2009 at 3:06pm
Hi,
I'd like to compare development and production oracle databases and I was thinking of doing a union comand to create a huge "table" that would have stuff in DEV not in PRD and vice versa, and then compare it to DEV and PRD silmotaniously so I wouldn't have to do it with two different rports.  I am familiar with commands in crystal and can combine two tables, but not of the same database.  Any suggestions?
 
Example;
 
DEV
30 year fixed
15 year fixed
5/1 ARM
7/1 ARM
 
PRD
30 year fixed
15 year fixed
5/1 ARM
10/1 ARM
 
Results
7/1 ARM     Not in PRD
10/1 ARM   Not in DEV
 
THANKS!!
in an effor to make the world less confusing for all
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum