The following SELECT statement doesn't necessarily return the desired record, indicating the QTY purchased on the date MAX(DATEBOT). I realize this result is correct, based on my statement.
However, I do need to return the exact record that corresponds to MAX(DATEBOT). Can this be done through a SELECT statement? I know how to do it using SCAN..ENDSCAN, but SELECT would be better if it can be done.
Appreciate any advice.
Thanks.
Code:
SELE PN,QTY,MAX(DATEBOT) LATEST;
FROM INVOICES;
GROUP BY PN
Appreciate any advice.
Thanks.