I am having a problem with oracle, it is not accepting a subquery in a left join, if I change to inner join it works, but it changes the result of my select then does not answer the solution. the problem happens with the following example:
CREATE TABLE A (ID INT, NOME VARCHAR2(50))
CREATE TABLE B (ID INT, ID_A INT, NUMERO NUMBER(8))
Query:
SELECT A.NOME
FROM A LEFT JOIN B
ON A.ID = B.ID_A AND B.NUMERO = (SELECT MAX(NUMERO) FROM B B2 WHERE B2.ID_A = A.ID)
I need to rewrite in a way that oracle accepts keeping as a left join.