Oracle
 sql >> Datenbank >  >> RDS >> Oracle

ORA-00904:Ungültiger Bezeichner in diesem Fall

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 Ihre erste Abfragespalte ist nicht vorhanden S.SALARY, also setzen Sie den Standardwert auf '0' ODER ''