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

Oracle SQL - Abfrage 2-Tabellen basierend auf ihren Fremdschlüsseln

Sie können bekommen, was Sie wollen, indem Sie Folgendes verwenden:

select *  from
(select name || ' ' || Surname Accounting from employees where depart_id = 1),
(select name || ' ' || Surname  IT from employees where depart_id =2)
union
select * from
(select name || ' ' || Surname Accounting from managers where depart_id = 1),
(select name || ' ' || Surname  IT from managers where depart_id =2)