select t1.id as t1_id, t2.id as t2_id from t1, t2 where t1.id = t2.id(+)
ID |
1 |
2 |
3 |
ID |
1 |
2 |
4 |
ROW_NUM | T1_ID | T2_ID |
1 | 1 | 1 |
2 | 2 | 2 |
3 | 3 | NULL |
レコードなし | NULL | 4 |
(+) | 挙動 |
あり | 絞り込み条件に一致したものだけ結合する(不一致のレコードは結合されないのでNULLになる) |
なし | 結合した後、絞り込み条件のレコードだけを返却 |
select t1.id as t1_id, t2.id as t2_id from t1, t2 where t1.id = t2.id(+) and t2.id(+) = 1; -- ★ここ
ROW_NUM | T1_ID | T2_ID |
1 | 1 | 1 |
2 | 2 | NULL |
3 | 3 | NULL |
レコードなし | NULL | 4 |
select t1.id as t1_id, t2.id as t2_id from t1, t2 where t1.id = t2.id(+) and t2.id = 1; -- ★ここ
ROW_NUM | T1_ID | T2_ID |
1 | 1 | 1 |
レコードなし | 2 | 2 |
レコードなし | 3 | NULL |
レコードなし | NULL | 4 |
select t1.id as t1_id, t2.id as t2_id from t1, t2 where t1.id = t2.id(+);
select t1.id as t1_id, t2.id as t2_id from t1 left join t2 on t1.id = t2.id;
select t1.id as t1_id, t2.id as t2_id from t1, t2 where t1.id = t2.id(+) and t2.id(+) = 1; -- ★
select t1.id as t1_id, t2.id as t2_id from t1 left join t2 on t1.id = t2.id and t2.id = 1; -- ★
select t1.id as t1_id, t2.id as t2_id from t1, t2 where t1.id = t2.id(+) and t2.id = 1; -- ★
select t1.id as t1_id, t2.id as t2_id from t1 left join t2 on t1.id = t2.id where t2.id = 1; -- ★