Scenario:
- Sage 100 ERP
- ProvideX ODBC Driver (32 bit)
- Standard SQL statement containing a column alias and GROUP BY statement.
Comments:
We are using the PVX/Sage ODBC connector with a standard Sage 100 ERP environment. The driver is working normally otherwise.
Examples:
1. Simple Column Alias
SELECT InvoiceDate as TheColumn,
SUM(NonTaxableSalesAmt) as Total
FROM AR_InvoiceHistoryHeader
WHERE InvoiceDate <= {d[startdate]} AND InvoiceDate >= {d[enddate]}
GROUP BY TheColumn
2. Calculated Column Alias
SELECT {fn MONTH(InvoiceDate)} as TheColumn,
SUM(NonTaxableSalesAmt) as Total
FROM AR_InvoiceHistoryHeader
WHERE InvoiceDate <= {d[startdate]} AND InvoiceDate <= {d[enddate]}
GROUP BY TheColumn
3. GROUP BY Calculation
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)}
Results:
- ERROR [S0000] [ProvideX][ODBC Driver]Column not found: TheColumn
- ERROR [S0000] [ProvideX][ODBC Driver]Column not found: TheColumn
- ERROR [37000] [ProvideX][ODBC Driver]Expected lexical element not found: (blank)
Summary:
- Is this a bug with the ProvideX driver, or an error with my SQL query?
- Are there any known work-arounds for this scenario?
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.