Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Tips and Tricks
Message Icon Topic: Linking Table Issue Post Reply Post New Topic
Author Message
mrc161
Newbie
Newbie


Joined: 27 Dec 2007
Location: United States
Online Status: Offline
Posts: 19
Quote mrc161 Replybullet Topic: Linking Table Issue
    Posted: 07 May 2008 at 12:04pm
Hello.  Don't know if this is possible but want to ask:
 
I have 2 tables, Table A and Table B.  They each have account numbers that I need to link together, however, they are stored differently in each table.
 
As an example, say that Table A has account number stored as 123456789 in one field (call the field Acct).
 
However, in Table B, the same account number is broken out into two separate fields.  So in Table B, you have a field that has 1234 (call it Field 1), and then an entirely separate field that has 56789 (call it Field 2).
 
So I need to link the Acct field from Table A to a combination of Field 1 and Field 2 from Table B.  Does that make sense?
 
I can do it via a subreport (I create a formula merging Field 1 and Field 2 and then link that formula to Acct in the primary report), but I didn't know if there was another way.  I'm not a big fan of subreports and would like to avoid it if possible.
 
Thoughts?  Thanks, Mike
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 08 May 2008 at 5:40am
You can do it in SQL, using the SQL Command object to build your data source.

SELECT TableA.*, TableB.*
FROM TableA
JOIN TableB
ON TableA.Acct = TableB.Field1 + TableB.Field2


That's probably the simplest solution.
IP IP Logged
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.031 seconds.