How to Join Tables in a DQL Script

Question

How do I instruct DataEase to perform any necessary table joins when I write a DQL Procedure?

Solution

DataEase performs the join automatically. The type of script you define determines the type of join that DataEase performs on the server. Except for the following case, DataEase performs a left outer join on any tables that are joined in a script.

Example

When you define a script that contains nested for commands, with no intervening DQL statements, DataEase performs an inner join on the two tables.

 

for ACTIVITIES ;

for MEMBERS

list records

ACTIVITIES ACTIVITY;

LASTNAME

MEMBERID .

end end

 

This example tells DataEase to: (1) process all the ACTIVITIES records, and (2) for each ACTIVITIES record, list the name of the activity and the LAST NAME and MEMBER ID from each related MEMBERS record.

The result of the join is a list of activities that currently have members who favor the activity. Any activities without members who list that activity as their favorite are not listed. Additionally, any members who haven't indicated a favorite activity are not listed.