Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Table Linking Post Reply Post New Topic
Author Message
dkalsow
Groupie
Groupie
Avatar

Joined: 10 Jan 2011
Location: United States
Online Status: Offline
Posts: 65
Quote dkalsow Replybullet Topic: Table Linking
     Posted: 04 Feb 2011 at 8:48am
I know this is kind of generic but I am hopping someone can point me in the right direction.  I have table A which is linked to tableB with an outer join.  Life is good. Everything works.
 
Now I add Table Cand link it to table A and I no longer get the same results I did with the orginal join.  I have changing the type of joins they are but can not get the desired results when I add table C.
 
Any ideas?  Tables B and C are only related through table A.
 
 
Thanks :)
dkalsow
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 Feb 2011 at 3:36am
Is table C also outer joined to table A?  What does your selection criteria look like?
 
-Dell
IP IP Logged
dkalsow
Groupie
Groupie
Avatar

Joined: 10 Jan 2011
Location: United States
Online Status: Offline
Posts: 65
Quote dkalsow Replybullet Posted: 08 Feb 2011 at 9:53am
Yes table C is also joined to table A through a foreign key.  There is only one record in table A but many in tables B & C which relate back to table A but not to each other.
Thanks :)
dkalsow
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 08 Feb 2011 at 10:26am
Because tables B and C are not related, for every record in Table A the query is returning each matching record in Table B matched to all of the records in Table C.
 
So, for example, if you have the following data:
Table A:
LinkingField
1
Table B:
LinkingField ValueB
1             1
1             2
TableC:
LinkingField ValueC
1             A
1             B
 
Your result set will look like this:
LinkingField ValueB ValueC
1             1        A
1             1        B
1             2        A
1             2        B
 
So, the question now is, what are you trying to display in your report.  If, for example, for every record in Table A you need to show All of the records in Table B and then all of the records in Table C, you'll need to remove Table C from the main report then create a subreport that contains only Table C and link from Table A in the main report to Table C in the subreport.  Put this subreport in a group footer for the Table A record.
 
-Dell
 
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