Oracle
 sql >> Database >  >> RDS >> Oracle

ORA-00904:identificatore non valido in questa istanza

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 La tua prima colonna di query non esiste S.SALARY quindi imposta il valore predefinito è "0" O ''