Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Merging two tables Post Reply Post New Topic
<< Prev Page  of 2
Author Message
Rob-VDMChem
Newbie
Newbie
Avatar

Joined: 17 Oct 2007
Online Status: Offline
Posts: 9
Quote Rob-VDMChem Replybullet Posted: 20 Nov 2007 at 12:06pm
OK I got it!!!  I was having an issue editing an existing report and it wasn't liking what I was doing.  Started from scratch, plugged in the command and BINGO she be working without a hitch!!  Thanks for the point in the right direction Brian!
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:27am
Originally posted by BrianBischof

No linking is necessary. What you are doing is creating two distinct lists of data from two different tables. The UNION keyword then appends the second list to the first list into a virtual table and makes it all appear as one single table. Thus, the number of rows in the new table will be equal to how many rows are in the first SELECT plus how many rows are in the second SELECT.


As a further note, you do have to make very sure that your columns line up, and that the datatypes in your columns are the same.  In the case you're working on here, that is pretty trivial.  In some other cases, you may have to some data type conversion and/or column aliasing to make everything line up right.  If the columns don't line up, SQL chokes (for, I think, fairly obvious reasons).


IP IP Logged
Rob-VDMChem
Newbie
Newbie
Avatar

Joined: 17 Oct 2007
Online Status: Offline
Posts: 9
Quote Rob-VDMChem Replybullet Posted: 21 Nov 2007 at 5:39am
Thanks Lugh,  Very good note.  Fortunately the field names were the same with the same data types for both tables.  The problem I was having was getting CR to not LOOP data over and over from one of the tables.  Once I started the report from scratch there were no issues.  Thanks for everyones help!!
IP IP Logged
kbrearey
Newbie
Newbie
Avatar

Joined: 08 Sep 2010
Location: United States
Online Status: Offline
Posts: 1
Quote kbrearey Replybullet Posted: 08 Sep 2010 at 8:16am
I know this is several years removed from the initial topic, but I was wondering if there was any way to do exactly this same function with 2 tables from different databases? The reason I ask is because I have a 'Live' database featuring data from between today and 30 days back. All previous data is in an 'Archive' database which resides on a different server (using a different DBMS). Is there any way to accomplish this same task with this situation in mind?
IP IP Logged
<< Prev Page  of 2
Post Reply Post New Topic
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



This page was generated in 0.047 seconds.