I want to create a table in Redshift by adding columns of the other two tables.
Want to create new table on following conditions
Using joins resulting table gives me only S4 to S7 and not other columns as required. Please help me
That's a full join
:
select
coalesce(t1.sid, t2.sid) sid,
coalesce(t1.totalcorrect, 0) + coalesce(t2.totalcorrect, 0) totalcorrect,
coalesce(t1.totalquestions, 0) + coalesce(t2.totalquestions, 0) totalquestions
from t1
full join t2 on t2.sid = t1.sid