This question already has answers here:
ORA-00918: column ambiguously defined in SELECT *

(3个答案)


已关闭6年。




这是SQL:
    SELECT alloc.oa_id
  FROM    qdod.qtran_owner_allocation alloc
       INNER JOIN
          (SELECT h.oa_id, h.div_ord_no, h.process_queue_id, h.from_ba_no,
                  h.from_ba_suf, h.from_interest_type_cd, h.from_interest_type_cd, h.from_div_ord_grp,
                  h.transfer_percent, h2.original_net_amount, h2.new_net_amount
             FROM    qdod.qtran_fund_transfer_hist h
                  INNER JOIN
                     (SELECT DISTINCT h0.oa_id, h0.original_net_amount, h1.new_net_amount
                        FROM    qdod.qtran_fund_transfer_hist h0
                             INNER JOIN
                                (SELECT h4.oa_id, SUM (h4.new_net_amount) AS new_net_amount
                                   FROM qdod.qtran_fund_transfer_hist h4
                                 GROUP BY h4.oa_id) h1
                             ON h0.oa_id = h1.oa_id
                       WHERE h0.original_net_amount <> h1.new_net_amount AND h0.oa_id >= 100000000) h2
                  ON h.oa_id = h2.oa_id) h3
       ON alloc.oa_id = h3.oa_id;

每列都有定义的表。单独运行时,主内部联接(分配表之后的一个)运行良好。任何想法为什么这不起作用?这是针对Oracle 10.2.0.4数据库执行的(我也针对11.2.0.1数据库尝试过此操作,认为这是否是Oracle错误,可以在11.2中解决,但同样会失败)。

最佳答案

语句中重复的字段,可能与它有关

h.from_interest_type_cd, h.from_interest_type_cd,

关于sql - 无法确定 "column ambiguously defined"的原因,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4268140/

10-10 02:42