Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Multiple Matches in Lookup Table Post Reply Post New Topic
Author Message
andge2
Newbie
Newbie
Avatar

Joined: 16 Nov 2009
Location: Canada
Online Status: Offline
Posts: 3
Quote andge2 Replybullet Topic: Multiple Matches in Lookup Table
    Posted: 16 Nov 2009 at 8:40am
I am designing a two-table report.
 
The first is a Room No. table which connects to a Resident table to get the resident information.
 
When the report finds that more than one resident has lived there (i.e. finds more than one matching record in the lookup table), the report skips over the room no. completely.
 
So, my report is only showing Room Numbers with one matching record in the second table.
 
I am using a left outer join, not enforced.
 
Any possible solutions to this problem?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Nov 2009 at 9:58am
Do you mean you want it to display all records?
Are you using a select statment (group or record)?
Why a left outer join? Are there records in the Room No Table that have no Records in the 'LookupTable' but you still want to see teh room no?
IP IP Logged
andge2
Newbie
Newbie
Avatar

Joined: 16 Nov 2009
Location: Canada
Online Status: Offline
Posts: 3
Quote andge2 Replybullet Posted: 16 Nov 2009 at 10:08am

Yes, the report should display all records - some rooms are vacant and I would like to see those on the report.

I am using a record select statement. The tables go through a G/L table as well so I can see pricing information.
 
Unit = Room No. table.
And G/L Accounts are being filtered ( The report should only show certain Account numbers), as well as a date filter on posting date (Only information for 2009):
 
 
 SELECT "Unit"."Unit", "Customer"."Name", "G/L Entry"."Amount", "G/L Entry"."Posting Date", "G/L Entry"."G/L Account No_"
 FROM   ("Unit" "Unit" LEFT OUTER JOIN "G/L Entry" "G/L Entry" ON ("Unit"."Unit"="G/L Entry"."Unit Code") AND ("Unit"."Tenant Code"="G/L Entry"."Source No_")) LEFT OUTER JOIN "Customer" "Customer" ON "G/L Entry"."Source No_"="Customer"."No_"
 WHERE  "G/L Entry"."Posting Date">={d '2009-01-01'} AND ("G/L Entry"."G/L Account No_"='52021' OR "G/L Entry"."G/L Account No_"='52022' OR "G/L Entry"."G/L Account No_"='52023' OR "G/L Entry"."G/L Account No_"='52024' OR "G/L Entry"."G/L Account No_"='52025' OR "G/L Entry"."G/L Account No_"='52511' OR "G/L Entry"."G/L Account No_"='52515' OR "G/L Entry"."G/L Account No_"='52516' OR "G/L Entry"."G/L Account No_"='52517')
 ORDER BY "Unit"."Unit"
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Nov 2009 at 10:17am
Try changing your WHERE to an AND.
Where's on outer joins can flip them to inner joins.
IP IP Logged
andge2
Newbie
Newbie
Avatar

Joined: 16 Nov 2009
Location: Canada
Online Status: Offline
Posts: 3
Quote andge2 Replybullet Posted: 16 Nov 2009 at 10:25am
That statement is a SQL Query that automatically generates when I use the Select Expert.
Is there an easy way to change the WHERE to an AND?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Nov 2009 at 10:31am
Sorry, thought you were using a COMMAND.
You can either write a SQL Command and use that as your data source or do this in a SQL view or Stored Procedure and use those as your source.
You can also use a view that does all of your filtering on the G?L entry table and then left join that view into the report instead of the original table.


Edited by DBlank - 16 Nov 2009 at 10:33am
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.029 seconds.