你好我如何在进行中4gl联合表?并显示

问题描述 投票:0回答:2

将变量i定义为整数no-undo。

For each Sports.customer where Sports.customer.CustNum = 1 AND Sports.Order.OrderDate = 11/21/1997 NO-LOCK. 
/* it says Missing for find etc */

我需要显示我使用他的主键的电梯游览的顺序,但是我无法访问这两个表

表客户PK CustNum订单PK OrderName FK客户编号

     Order-line PK Orderline

我需要显示日期为11/21/1997的升降机旅行的订单,并显示升降机旅行的总价格

谢谢你们

openedge progress-4gl progress-db
2个回答
1
投票

对于总价,您必须加入Order和OrderLine。

DEFINE VARIABLE deTotal AS DECIMAL NO-UNDO. 
FOR EACH Order WHERE Order.CustNum = 1 WHERE Order.OrderDate = 11/21/1997 NO-LOCK, 
    EACH OrderLine OR Order NO-LOCK:
    ASSIGN deTotal = deTotal = deTotal + OrderLine.Qty * OrderLine.Price . 
END.

1
投票
define variable orderTotal as decimal no-undo.

for each customer no-lock where name = "Lift Tours",
    each order no-lock where order.custNum = customer.custNum and order.orderDate = 11/21/1997,
    each orderLine no-lock where orderLine.orderNum = order.orderNum:

  orderTotal = orderTotal + ( orderLine.Qty * orderLine.price ).

end.

display orderTotal.

“,”用于在FOR EACH中加入WHERE子句。您可以在这些WHERE子句中指定要进行联接的公共字段。

© www.soinside.com 2019 - 2024. All rights reserved.