This query will join three tables: Customer, Order and Orderline.
The use of the OF
statement as in childtable OF parenttable
assumes that indexes are constructed in a specific way. That is the case in the sports2000-database.
DEFINE QUERY q1 FOR Customer, Order, Orderline.
OPEN QUERY q1 FOR EACH Customer WHERE Customer.state = 'TX'
, EACH Order OF customer WHERE order.custnum < 1000
, EACH orderline OF order.
GET FIRST q1.
DO WHILE NOT QUERY-OFF-END('q1'):
DISPLAY Customer.Name Order.OrderNum OrderLine.LineNum
WITH FRAME frameA 20 DOWN.
DOWN WITH FRAME frameA.
GET NEXT q1.
END.
CLOSE QUERY q1.
Result: In Windows GUI: