Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Problem with Join Post Reply Post New Topic
Author Message
nike_niit
Newbie
Newbie
Avatar

Joined: 27 Oct 2010
Online Status: Offline
Posts: 2
Quote nike_niit Replybullet Topic: Problem with Join
     Posted: 17 Apr 2011 at 8:38pm

This is the Sql-Query

SELECT "tempBillDetails"."SampleNumber", "tempBillDetails"."Description", "tempBillDetails"."Amount", "tempBilling"."BillNo", "tempBilling"."BillDate", "tempBilling"."PartyName", "NewSampleEntrys"."NameOfSample", "NewSampleEntrys"."BatchNo", "tempBilling"."AgmarkCharges", "tempBilling"."DisplayName", "tempBilling"."OtherCharges", "tempBilling"."Discount", "tempBilling"."OtherChargesFor", "Charges"."FTest", "Charges"."Flag"
 FROM   ("Quali"."dbo"."NewSampleEntrys" "NewSampleEntrys" INNER JOIN (("Quali"."dbo"."tempBillDetails" "tempBillDetails" left OUTER JOIN "Quali"."dbo"."tempBilling" "tempBilling" ON "tempBillDetails"."BillNo"="tempBilling"."BillNo") INNER JOIN "Quali"."dbo"."SampleRegistration" "SampleRegistration" ON "tempBillDetails"."SampleNumber"="SampleRegistration"."SampleNumber") ON "NewSampleEntrys"."QLID"="SampleRegistration"."QlCode") INNER JOIN "Quali"."dbo"."Charges" "Charges" ON "SampleRegistration"."QlCode"="Charges"."QlCode"
 ORDER BY "tempBillDetails"."SampleNumber"

it work fine if all tables having data.
my problem is that it only "billingdetails" contain record and no matching record in other table my report show blank.
how can i solve this problem plz help.
Nikhil M Bhivgade
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Apr 2011 at 3:13am
use and outer join.  Typically 1 table has a list of values that you want to see all the time.  This becomes the 'main' table, the rest of the tables can be left outer joined to this table or left outer joined to the appropriate table as required by linking.
 
I use left outer joins, just because it is easier for me think of while I type the query.  It's all about Venn Diagrams, and left is easier for me than right outer joins.
 
HTH
 
oh yeah, if you right click on a link between tables you can change the style, it defaults to innner joins, which gives the behavior that you are seening.
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