Monday, November 26, 2018

ODBC SQL for Reports > Sales > Sales by Customer

 

In ODBC, the following SQL can be used to create this similar report in the user interface: Reports > Sales > Sales by Customer


SELECT CUSTOMERS.COMPANYNAME, -(Sum(TRANSACTION_LINES.AMOUNT)) AS 'Sum of AMOUNT'
FROM Administrator.CUSTOMERS CUSTOMERS, Administrator.TRANSACTION_LINES TRANSACTION_LINES
WHERE CUSTOMERS.CUSTOMER_ID = TRANSACTION_LINES.COMPANY_ID and CUSTOMERS.COMPANYNAME IS NOT null
GROUP BY CUSTOMERS.COMPANYNAME

No comments:

Post a Comment