Duplicate columns in Oracle query using row limiting clause
Seems in this case when you are using the row limiting clause, Oracle internally calling the ROW_NUMBER()
function where it using the column name in OVER
clause Like ROW_NUMBER OVER(ORDER BY ID)
. because of this you are getting the ORA-00918 error
.
I noticed that you have an implicit join. It would be interesting to see if the problem goes away when joining explicitly. I'm wondering if behind the scenes Oracle is doing a join based on id=id and not using the table aliases you assigned them.
That would also explain the column aliases fixing the issue. Try explicitly joining; that could force oracle to use the table aliases and resolve the ambiguity it thinks it sees.