Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
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.
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
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?
Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
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?
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
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?
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