We are using the PVX/Sage ODBC connector with a standard Sage 100 ERP environment. The driver is working normally otherwise.
SELECT InvoiceDate as TheColumn,
SUM(NonTaxableSalesAmt) as Total
FROM AR_InvoiceHistoryHeader
WHERE InvoiceDate <= {d[startdate]} AND InvoiceDate >= {d[enddate]}
GROUP BY TheColumn
SELECT {fn MONTH(InvoiceDate)} as TheColumn,
SUM(NonTaxableSalesAmt) as Total
FROM AR_InvoiceHistoryHeader
WHERE InvoiceDate <= {d[startdate]} AND InvoiceDate <= {d[enddate]}
GROUP BY TheColumn
SELECT {fn MONTH(InvoiceDate)} as TheColumn,
SUM(NonTaxableSalesAmt) as Total
FROM AR_InvoiceHistoryHeader
WHERE InvoiceDate <= {d[startdate]} AND InvoiceDate <= {d[enddate]}
GROUP BY {fn MONTH(InvoiceDate)}
Clarification: I am not specifically looking for the solution for this exact use case, but a general solution for the Column Alias/GROUP BY combination.
After a long back-and-forth with Sage and ProvideX, here is the conclusion on GROUP BY with the Sage MAS 100 ERP connector: The ProvideX documentation is not accurate for the Sage driver because of customizations on the part of Sage. The ODBC driver used with Sage MAS 100 ERP does not support aliases or functions with GROUP BY statements. The GROUP BY statement must be in the form of GROUP BY [actual column].
An alternative work around to use a simple query (SELECT without GROUP BY), and either 1) do the GROUP BY operation in your application or 2) Import the data into Microsoft Access or another DBMS as a pass-through query, and do the complex query in Access.