gpt4 book ai didi

sql - ORA-00933: SQL 命令未在带有连接的子查询中正确结束

转载 作者:行者123 更新时间:2023-12-04 06:22:50 25 4
gpt4 key购买 nike

自从我上次执行 Oracle SQL 以来已经有一段时间了,希望有人能告诉我为什么我得到 933:

   SELECT TRIM(A.ACCOUNTNUMBER) AS INDBDebnmbr
, TRIM(A.VOUCHER) AS INinvoicenmbr
, A.DATE_ AS INinvoiceDate
, A.DUEDATE AS INinvoiceDueDate
, A.TXT AS INDescription
, A.EXCHANGECODE AS INCurrencyCode
, subq.AMOUNTMST AS INOriginalamount
, subq.SETTLEAMOUNTMST AS INpaidAmount
, subq.OPENAMOUNT AS INOpenAmount
FROM (
SELECT DEBTRANS.VOUCHER AS VOUCHER, SUM(DEBTRANS.AMOUNTMST) AS AMOUNTMST
, SUM(DEBTRANS.SETTLEAMOUNTMST) AS SETTLEAMOUNTMST
, SUM(DEBTRANS.AMOUNTMST - DEBTRANS.SETTLEAMOUNTMST) AS OPENAMOUNT
FROM XAL_SUPERVISOR.DEBTRANS DEBTRANS
WHERE DEBTRANS.OPEN = 1 AND
DEBTRANS.TRANSTYPE <> 9 AND
(DEBTRANS.AMOUNTMST - DEBTRANS.SETTLEAMOUNTMST) <> 0 AND
DEBTRANS.DATASET = 'FIK'
GROUP BY DEBTRANS.VOUCHER) subq INNER JOIN DEBTRANS A ON A.VOUCHER = subq.VOUCHER

在 SQL Plus 中
提前致谢,

迈克尔

最佳答案

您对使用 8i 的评论对此进行了解释。 ANSI '92 Join 语法直到 9i 才在 Oracle 中实现。

您将需要修改您的查询:

       SELECT TRIM(A.ACCOUNTNUMBER) AS INDBDebnmbr
, TRIM(A.VOUCHER) AS INinvoicenmbr
, A.DATE_ AS INinvoiceDate
, A.DUEDATE AS INinvoiceDueDate
, A.TXT AS INDescription
, A.EXCHANGECODE AS INCurrencyCode
, subq.AMOUNTMST AS INOriginalamount
, subq.SETTLEAMOUNTMST AS INpaidAmount
, subq.OPENAMOUNT AS INOpenAmount
FROM (
SELECT DEBTRANS.VOUCHER AS VOUCHER, SUM(DEBTRANS.AMOUNTMST) AS AMOUNTMST
, SUM(DEBTRANS.SETTLEAMOUNTMST) AS SETTLEAMOUNTMST
, SUM(DEBTRANS.AMOUNTMST - DEBTRANS.SETTLEAMOUNTMST) AS OPENAMOUNT
FROM XAL_SUPERVISOR.DEBTRANS DEBTRANS
WHERE DEBTRANS.OPEN = 1 AND
DEBTRANS.TRANSTYPE <> 9 AND
(DEBTRANS.AMOUNTMST - DEBTRANS.SETTLEAMOUNTMST) <> 0 AND
DEBTRANS.DATASET = 'FIK'
GROUP BY DEBTRANS.VOUCHER) subq,
DEBTRANS A
WHERE A.VOUCHER = subq.VOUCHER;

关于sql - ORA-00933: SQL 命令未在带有连接的子查询中正确结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6358057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com