I have the following query…
SELECT *
FROM TDM_FORMS
JOIN TDM_ATTRIBUTES USING (FORM_ID)
Now I want to add an OUTER APPLY to add yet another fetch…
SELECT COUNT(OP_CODE) OPCNT, LISTAGG(OP_CODE) WITHIN GROUP (ORDER BY OP_CODE) OPLST
FROM TDM_CONFIG {Where FORM_IDs are the same}
As the column is named FORM_ID in all tables, I need to specify in the OUTER APPLY that one of the Columns comes from outside the subquery. Usually I would just indicate the TDM_FORMS’s FORM_ID its table & call it a day, like this:
SELECT *
FROM TDM_FORMS
JOIN TDM_ATTRIBUTES USING (FORM_ID)
OUTER APPLY (SELECT COUNT(OP_CODE) OPCNT, LISTAGG(OP_CODE) WITHIN GROUP (ORDER BY OP_CODE) OPLST
FROM TDM_CONFIG WHERE FORM_ID = TDM_FORMS.FORM_ID)
The problem is that USING cannot have qualifiers, so I’m getting ORA-25154 column part of USING clause cannot have qualifier.
Is there a way to do this without having to change the USING clause?