设想:
- 贤者 100 ERP
- ProvideX ODBC 驱动程序(32 位)
- 包含列别名和 GROUP BY 语句的标准 SQL 语句。
注释:
我们将 PVX/Sage ODBC 连接器与标准 Sage 100 ERP 环境一起使用。驱动程序正常工作,否则。
例子:
1.简单的列别名
SELECT InvoiceDate as TheColumn,
SUM(NonTaxableSalesAmt) as Total
FROM AR_InvoiceHistoryHeader
WHERE InvoiceDate <= {d[startdate]} AND InvoiceDate >= {d[enddate]}
GROUP BY TheColumn
2.计算列别名
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 计算
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)}
结果:
- 错误 [S0000] [ProvideX][ODBC 驱动程序]列未找到:TheColumn
- 错误 [S0000] [ProvideX][ODBC 驱动程序]列未找到:TheColumn
- 错误 [37000] [ProvideX][ODBC 驱动程序] 找不到预期的词法元素:(空白)
概括:
- 这是 ProvideX 驱动程序的错误,还是我的 SQL 查询错误?
- 这种情况是否有任何已知的解决方法?
澄清:我并不是专门为这个确切的用例寻找解决方案,而是为 Column Alias/GROUP BY 组合寻找通用解决方案。