The inner join is the default join type in a multi-table read or query. Use this type of join where you are only concerned with the data on the left side of the join for which there is related data on the right. For example, you might want to see only those Customers whose purchase of a single item comes close to their credit limit.
The query in i-join1.p performs three inner joins on the sports2000 database to return this data.
OPEN QUERY q1 PRESELECT EACH Customer,
/*1*/ EACH Order OF Customer,
/*2*/ EACH OrderLine OF Order
WHERE (OrderLine.Price * OrderLine.Qty) >
(.667 * Customer.CreditLimit),
/*3*/ EACH Item OF OrderLine.
ENABLE b1 WITH SIZE 68 BY 10.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
These three items correspond to the /*1*/, /*2*/, and /*3*/ that label the joins in the i-join1.p example:
1. To each Customer, join all related Order records.
2. To each Order in the previous join, join each related OrderLine record whose total purchase is greater than two-thirds the Customer's credit limit.
3. To each OrderLine in the previous join, join the related Item record to get the item name.
When executed, you get the output shown in the following figure. Thus, the relation of Order to Customer and the selection criteria on OrderLine reduces the total number of query rows from thousands of possible rows to four.