Consultor Eletrônico



Kbase P89749: How to emulate a 4GL FIND FIRST or FIND LAST query in CorVu
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/29/2004
Status: Unverified

GOAL:

How to emulate a 4GL FIND FIRST or FIND LAST query in CorVu

FACT(s) (Environment):

CorVu

FIX:

CorVu uses SQL to generate its queries. In SQL there is no direct equivalent of the Progress 4GL FIND FIRST/LAST statement, however.

The following example using sports was tested with 9.1D09 and CorVu 4.20.184.

This 4GL query -

FOR EACH customer, FIRST order OF customer:
DISP customer.cust-num NAME order-num order-date.
END.

- should find the first order for each customer and display the relevant information. The following SQL emulates that behaviour -

SELECT
b.Cust-Num,
b.Name,
a.Order-num,
a.Order-Date
FROM
Customer b,
Order a

WHERE
a.cust-num=b.cust-num AND
a.order-num=(select min(order-num) FROM order WHERE cust-num=b.cust-num)

This code can be run from the CorVu Graphical Analysis, using the Edit SQL option.

See also - What are the Progress SQL-92 equivalents of 4GL FIND FIRST and FIND LAST?