Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Linking 2 tables using multiple fields Post Reply Post New Topic
Author Message
nix1016
Groupie
Groupie


Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
Quote nix1016 Replybullet Topic: Linking 2 tables using multiple fields
     Posted: 25 Jun 2012 at 1:52am
Hi,

I have a report that is currently linked in the database joins as such:

Table1.x -> Table2.x (left outter join).

I need to modify the report so that it basically links as follows:
Table1.x = Table2.x or Table1.y = table2.y.

However, if I add another link from Table1.y to Table2.y it merely ovewrites the previous link so I only get the records from this new join.

I have tried having no joins between the 2 tables (or changing the join Table1.x = Table2.x to a right-outter join) and then adding the condition {Table1.x = Table2.x} or {Table1.y = table2.y} in the select expert  and it just gives me an error.

Is there another, easier way to do this?

Thanks!

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 25 Jun 2012 at 3:22am
You can't have an OR when you join the tables together in the Database Expert.  You should be able to do this in your selection criteria.  What is the error you're getting?
 
-Dell
IP IP Logged
nix1016
Groupie
Groupie


Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
Quote nix1016 Replybullet Posted: 25 Jun 2012 at 5:38am
Ah, the error I'm getting when setting the current link to right outter join and putting the join criteria in the selection expert is: cannot retrieve data from the database (database vendor code: -20024). Not sure if it might be related to having too much records in the 2nd table i'm joining to?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 25 Jun 2012 at 7:55am

What type of database are you connecting to?  When you get a database vendor code, you need to look in the documentation for your database to get more info about the error and see what might be causing it.

 
Having said that, Crystal does not handle or conditions in joins.  So, you'll have to use the Select Expert to do the join.  You state in your original message that you've tried this and received an error.  What is the error?
 
-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