左外部結合で 3 つのテーブルを結合するにはどうすればよいですか? table1 と table2 の間で左外部結合を行うことはできましたが、table3 を行うことはできませんでした。
以下を試してみましたが、table3との結合方法がわかりません。
select tab1.id, tab2.status, tab3.job_history
from table1 tab1
left outer join table2 tab2 on tab1.id=tab2.id
where tab1.job_title='accounting'
私のテーブルスキーマは次のとおりです。
table 1:
id number(5) primary key,
status_code number(5),
job_title varchar2(20)
name varchar2(30)
table 2:
status_code number(5) primary key,
status varchar2(15)
table 3:
id number(5)
job_history varchar2(20)
条件:
table1.status_code
することができますnull
table1.id
に一致するものがない可能性がありますtable3.id
table1 にあるレコードtable1.job_title = 'accounting'
または table3 にtable3.job_history = 'accounting'
あるレコードを検索しtable1.id = table3.id
、table2 のステータスを取得したいtable1.status_code = table2.status_code