Progress
Programming
Handbook
Using Inner Joins
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
p-join1.p
performs three inner joins on the sports database to return this data. These three items correspond to the/*1*/
,/*2*/
, and/*3*/
that label the joins in thep-join1.p
example:
- To each Customer, join all related Order records.
- To each Order in the previous join, join each related Order–Line record whose total purchase is greater than two-thirds the customer’s credit limit.
- To each Order–Line in the previous join, join the related Item record to get the item name.
When executed, you get the output shown in Figure 9–5. Thus, the relation of Order to Customer and the selection criteria on Order–Line reduces the total number of query rows from thousands of possible rows to four.
Figure 9–5: Inner Join Example
![]()
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |