列模糊地定义了oracle错误

时间:2015-11-07 20:15:16

标签: sql oracle

当我运行此代码时,每次“模糊定义列”时。无法解决这个问题。我无法理解错误原因。

SELECT dc.name, COUNT(am.idn), adm.count 
FROM vpdgk.vp_admin am 
    INNER JOIN vpdgk.vp_mufettish mf ON am.mufet_id = mf.IDN
    INNER JOIN dictionaries.customs_main dc ON dc.code_int = mf.FIRM
    LEFT JOIN (
            SELECT C.MUFET_ID, d.name name, b.name, COUNT(c.MUFET_ID) count
            FROM vpdgk.vp_qeydiyyat A
                INNER JOIN vpdgk.vp_mufettish b ON b.IDN = A.mufet_id 
                INNER JOIN vpdgk.vp_admin c ON c.mufet_id = A.mufet_id 
                        AND (c.uid_ is not null or c.uid_reserv is not null)
                INNER JOIN dictionaries.customs_main d ON d.code_int = b.FIRM
            WHERE TRUNC(A.INSERT_DATE) BETWEEN TO_DATE('01.01.2015','DD.MM.YYYY') 
                       AND TO_DATE('30.01.2015','DD.MM.YYYY')
            GROUP BY C.MUFET_ID, d.name, b.name
            Having COUNT(c.MUFET_ID) < 10) adm
        ON dc.name = adm.name
GROUP BY dc.name, adm.count;

1 个答案:

答案 0 :(得分:1)

您的错误在这里:

...
LEFT JOIN (
SELECT C.MUFET_ID, d.name name, b.name, COUNT(c.MUFET_ID) count
...

您定义了两次列名name。改变其中一个。同时在Group By

中更改它