Operation Manual

Understanding Databases
Linking tables
25
Crystal Reports User’s Guide 505
Equal [=] link
The result set from an Equal link includes all the records where the linked field
value in both tables is an exact match. In the following example, the
Customer table is linked to the Orders table by the Customer ID field. When
the program finds a Customer ID in the Orders table that matches a Customer
ID in the Customer table, it displays information for the corresponding records
in both tables.
SQL uses the following syntax to describe an Equal link:
SELECT Customer.‘Customer ID‘,
Customer.‘Customer Name‘,
Orders.‘Order Amount‘
FROM ‘Customer‘ Customer,
‘Orders‘ Orders
WHERE Customer.Customer ID =
Orders.Customer ID
This statement produces the following data:
Greater Than [>] link
The result set from a Greater Than link includes all records in which the linked
field value from the primary table is greater than the linked field value in the
lookup table. As an example, a company may want to compare the salaries
made by all their sales representatives to the salaries made by all their sales
managers. The company executives want to make sure no sales
representative is making more money than any manager.
Customer Table Customer Table Orders Table
Customer ID Customer Name Order Amount
52 Allez Distribution 25141.50
53 BG Mountain Inc. 19164.30
53 BG Mountain Inc. 1683.60
57 Hansen MTB Inc. 15716.40
58 La Bomba de Bicicleta 1956.20
60 Mountain Toad 24580.50
62 SFB Inc. 7911.80
63 Sierra Bicycle Group 19766.20
63 Sierra Bicycle Group 12763.95
64 Sierra Mountain 8233.50