Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

ORA-00904:identificador inválido nesta instância

SELECT Bld.id,C.code,M.FIRST_NAME,M.LAST_NAME,Bld.Address,M.ADDRESS,D.DOB, '0' AS S.SALARY
    from HW1_PERSON M
    inner join HW1_BUILDING Bld
    ON M.id = Bld.id
    INNER JOIN HW1_PERSON M 
    ON Bld.id = M.id
    INNER JOIN HW1_PERSON M 
    ON M.id = Bld.id
    Inner JOIN HW1_BUILDING Bld
    ON Bld.id = M.id
    INNER JOIN HW1_BUILDING C
    ON M.id = C.id
    INNER JOIN HW1_PERSON D
    ON M.id = D.id
    UNION ALL
    SELECT Bld.id,C.code,M.FIRST_NAME,M.LAST_NAME,Bld.Address,M.ADDRESS,D.DOB,S.SALARY FROM HW1_STAFF S
    where S.SALARY = NULL
    ;

I Sua primeira coluna de consulta não existe S.SALARY então defina o padrão é '0' OU ''