You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
626 B
SQL

SELECT CUSTOMER_NO AS Customer,
CUSTOMER_NAME,
ACCT_CURRENCY_CODE AS Currency,
SUM(NET_AMOUNT) AS Sales,
SUM(INVOICED_QTY) AS Quantity
FROM CUST_ORD_INVO_STAT t
Where (TRUNC(INVOICE_DATE) >= TO_DATE('&Valid_From', 'MM/DD/YYYY') AND
TRUNC(INVOICE_DATE) <= TO_DATE('&Valid_To', 'MM/DD/YYYY'))
AND COMPANY LIKE '%&COMPANY%'
AND AUTHORIZE_CODE LIKE '%&AUTHORIZE_CODE%'
AND CUST_GRP LIKE '%&CUST_GRP%'
GROUP BY CUSTOMER_NO, CUSTOMER_NAME, ACCT_CURRENCY_CODE
ORDER BY Sales DESC, Quantity DESC
FETCH NEXT 10 ROWS ONLY
-- Lov reference is removed due to limitations in IFS cloud