Nuñito de la Calzada Nuñito de la Calzada - 7 months ago 20
SQL Question

ORACLE JOIN TABLES

I have

T1: USER_ID OSX
1 Y
2 Y

T2: USER_ID ANDROID
1 Y
3 Y


I want to join the tables as follows but i don't know how

T3: USER_ID ANDROID OSX
1 Y Y
2 null Y
3 Y null

Answer

You want a full outer join:

select coalesce(t1.user_id, t2.user_id) as user_id,
       t2.android, t1.osx
from t1 full join
     t2
     on t1.user_id = t2.user_id;