我有一些用 VFP 制作的 .dbf 文件。我必须和他们一起工作并偶尔编辑它。最近我注意到其中一个 .dbf`s 以错误的方式运行。表中显示的记录数与实际记录数不符。我试图修改此表的标题以反映估计的记录数,但没有结果。我怎样才能取回我的原始文件?
BuZZ-dEE
Asked:
2014-02-14 00:34:53 +0800 CST
我有一种方法可以重写 SQL 查询,所以我可以避免IFNULL
or COALESCE
,因为 HXTT DBF JDBC 驱动程序(支持 SQL92)会抛出以下错误:
Caused by: java.sql.SQLException: The aggregate function SUM(NETTO) can only be used in select-list, HAVING clause, and ORDER BY clause of SELECT statement.
以下查询导致上述错误:
SELECT
( SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue
FROM tckopf AS shipManagementInvoice
WHERE shipManagementInvoice.referenzid = 1
AND shipManagementInvoice.btyp = 5 )
-
( SELECT IFNULL (SUM (shipManagementCreditNote.netto), 0) AS shipManagementCreditNoteNetValue
FROM tckopf AS shipManagementCreditNote
WHERE shipManagementCreditNote.referenzid = 1
AND shipManagementCreditNote.btyp = 6 )
AS shipManagementResult
如果我删除IFNULL
or COALESCE
,则没有错误。
BuZZ-dEE
Asked:
2014-02-12 10:42:54 +0800 CST
我有以下两个查询:
shipManagementInvoiceNetValue
:SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue FROM tckopf AS shipManagementInvoice WHERE shipManagementInvoice.referenzid = 1 AND shipManagementInvoice.btyp = 5
shipManagementCreditNoteNetValue
:SELECT IFNULL (SUM (shipManagementCreditNote.netto), 0) AS shipManagementCreditNoteNetValue FROM tckopf AS shipManagementCreditNote WHERE shipManagementCreditNote.referenzid = 1 AND shipManagementCreditNote.btyp = 6
但我需要结果shipManagementInvoiceNetValue - shipManagementCreditNoteNetValue
。我使用的HXTT JDBC DBF 驱动程序支持的不仅仅是 SQL92。
我怎么能意识到这一点?