Print Page | Close Window

Comparing two field from different tables in CR

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9983
Printed Date: 02 May 2025 at 11:59pm


Topic: Comparing two field from different tables in CR
Posted By: Inakawa
Subject: Comparing two field from different tables in CR
Date Posted: 11 May 2010 at 6:53pm
Hi,

I have two tables as follows

Table1
Field1   Field2
1        500   
2        600
3        300
4        400
5        200

Table2
Field1
1
3
5

The value in table one field1, contain values for table2 field1.

Now I want to compare Table2 field1 with Table1 Field1, if it return true, then print the corresponding value from table1 field2. If this is false though, to skip the record and continue searching for the second record.

So basically I want my end results (report) to be:

Table2.field1        Table1.field2
1                      500                         
3                      300
5                      200

Can anyone help please.

Thanks.



Replies:
Posted By: DBlank
Date Posted: 12 May 2010 at 4:36am
Use the Databse expert
add table 1
add table 2
inner join table1 to table 2 on field 1
use table2.field1 and table1.field2 on your report canvas.
 
the join will omit the fields with no match.



Print Page | Close Window