Case 1 - #table1 contains all codes
select t1.code,t1.total1,t2.total2,t3.total3
from #table1 t1
left join #table2 t2 on t2.Code=t1.Code
left join #table3 t3 on t3.code=t1.Code
Case 2 - none of the tables contains all codes
select c.code,t1.total1,t2.total2,t3.total3
from (
select code from #table1
union
select code from #table2
union
select code from #table3
) c
left join #table1 t2 on t1.Code=c.Code
left join #table2 t2 on t2.Code=c.Code
left join #table3 t3 on t3.code=c.Code