Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: linking two tables Post Reply Post New Topic
Author Message
ClassicParts
Newbie
Newbie


Joined: 15 Jan 2009
Location: United States
Online Status: Offline
Posts: 2
Quote ClassicParts Replybullet Topic: linking two tables
     Posted: 15 Jan 2009 at 11:50am
I just bought the book off of Amazon but I really would like some help with working with a database. 

I am working with two tables in the same SQL database.  Basically I am looking at a date range and want to find all customers that have not requested a Catalog while placing an order and/or who have also not requested a catalog from us thru a contact request.  I can do one or the other but I can get it to look at both data requests.  The part number that I am filtering is in the ITEMS table and the catalog request is in the CONTACT table.  I want the report to return all customers that have not ordered part # "CAT-1" on an order  or requested a CATALOG thru a contact request.(non-order). 

My goal is to find all customers in a date range that have not recv'd a Catalog (by item # or contact request) so that we can send them one.
IP IP Logged
ClassicParts
Newbie
Newbie


Joined: 15 Jan 2009
Location: United States
Online Status: Offline
Posts: 2
Quote ClassicParts Replybullet Posted: 15 Jan 2009 at 12:13pm
DATABASE = CPI
Table:CUST = "customerID"
Table:CONTACT = 1, 2, 3, 4, 5, 6
Table:ITEMS =  CAT-1, CAT-2, CAT-3, CAT-4, CAT-5, CAT-6

Look in CUST and find all customers that do no have "1, 2, 3, 4, 5, 6" in the CONTACT table and "CAT-1, CAT-2, CAT-3, CAT-4, CAT-5, CAT-6" in the ITEMS table. 

The result that should be returned is a list of Customers that don't have one or the other values in either table...but I can't seem to get the results.  I can create a report that shows me all customers that don't have a CONTACT code of 1, 2, 3, 4, 5, 6.  I can also create a report that shows all Customers that have an ITEM of "CAT-1, CAT-2, CAT-3, CAT-4, CAT-5, CAT-6".  I can't seem to get both though using the and function.  I am assuming it has something to do with linking the two tables correctly???




Edited by ClassicParts - 15 Jan 2009 at 12:38pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Jan 2009 at 1:58pm
How and on what are your tables joined?
Is your CUST table joined to the CONTACT and ITEMS or is ITEMS joined to CONTACTS and on what fields? From your description this probably needs to be an OR process not an AND process because the catalog information can be in the CONTACT or ITEMS tables correct?
Since this is in SQL you could handle this via a view and then use the view in your report.


Edited by DBlank - 15 Jan 2009 at 2:00pm
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