The example for Inner, Left, and Right joins use the OPPORTUNITY and ACTIVITY tables to demonstrate each type of join. The OPPORTUNITY and ACTIVITY tables each contain the OPPORTUNITYID field. Opportunities can exist without associated activities. Activities can exist that are not related to an opportunity. Each join example uses the same opportunity and activity records to demonstrate that different types of joins result in different records being selected. The join results records are shown in a separate column in each of the three types of joins.
In the join type examples, the OPPORTUNITY and ACTIVITY tables contain the following records:
OPPORTUNITY Table | ACTIVITY Table | ||
---|---|---|---|
Opportunity1 |
(Activity 3) (Activity 7) |
Activity 1 | |
Opportunity2 | Activity 2 | ||
Opportunity3 | Activity 3 | (Opportunity1) | |
Opportunity4 | (Activity 4) | Activity 4 | (Opportunity4) |
Opportunity5 | (Activity 6) | Activity 5 | |
Activity 6 | (Opportunity5) | ||
Activity 7 | (Opportunity1) |
Note the following:
For each of the three types of joins, see the example: