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 Twoja pierwsza kolumna zapytania nie istnieje S.SALARY, więc ustaw wartość domyślną „0” LUB „”