Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Inner Joins Post Reply Post New Topic
Author Message
shifty
Newbie
Newbie
Avatar

Joined: 12 Jul 2007
Location: United Kingdom
Online Status: Offline
Posts: 17
Quote shifty Replybullet Topic: Inner Joins
     Posted: 08 May 2008 at 8:00am
I have two tables
 
One called Appointments Tables and the other called action plans.  Both these tables contain a field called Plan_Id and Plan_Number.
 
I have joined both these tables by these fields using a inner join, I am only expecting to see data that is an exact match.
 
Now when I drag both plan_id from both tables to the report and click preview it shows the exact match, however if I just drag say a fields called Text_col from the appointments table then I am expecting to see the text col field only for that one row that I know exists in the database, I am getting many appointments that are not part of the match.
 
Now I am prity sure I got this right, if I link to fields between two tables and select inner join type that the return to the report should only contain data that exists in both tables as an exact match?
 
am i right?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 08 May 2008 at 8:19am
Which direction is your join?  From appointments to action plans or vice versa?  That can affect what data is selected.  Try changing the direction and see how that works for you.
 
-Dell
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 8:28am
Your best option, when attempting to diagnose a join issue, is to create a report that just shows all the results in basic grid form.  Try sorting it in different ways, and see if you can figure out where the issue is.

My guess, at this point, is that at least one of your tables has multiple records for a given Plan_ID and Plan_Number.


IP IP Logged
shifty
Newbie
Newbie
Avatar

Joined: 12 Jul 2007
Location: United Kingdom
Online Status: Offline
Posts: 17
Quote shifty Replybullet Posted: 12 May 2008 at 9:14am
Thanks for your input guys.
 
It was a silly mistake, I had appointments that didn't exist as part of a plan and therefore did not have a plan id.  So my report was returning the other values as they were blank.
 
I have now added a record selection to exclude null values and the correct data is now returning as id expect.
 
thanks for your help guys
 
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