1
I am having a problem with oracle, it is not accepting a subquery in a left Join, if I change to Inner Join works, but changes the result of my select so it does not meet 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 the oracle accepts keeping as left Join.
Thanks for the reply, but it’s not working because table A does not have field number.
– user1631012
I reinterpreted your query and I remade my answer. See if this suits you.
– Jônatas Hudler
This returns more than one line, it should return only one. Because the original query in sql server returns only one because of max.
– user1631012