I have used 3 tables tab1,tab2,tab3 each having col1,col2 as two columns of type int. Modify this according to your tables. i have assumed col1 of both tab1 and tab2 as primary key and sequential values for col1 as 1,2,3,4,5
You may need to remove the loop if taht not the case
declare @i int
set @i=0
declare @max int
select @max=count(*) from tab1
while(@i<@max)
BEGIN
declare @sum1 int
declare @sum2 int
select @sum1=a.col1+b.col1 from tab1 a JOIN tab2 b ON a.col1=b.col1 where a.col1=@i
select @sum2=a.col1+b.col1 from tab1 a JOIN tab2 b ON a.col1=b.col1 where a.col1=@i
select a.col2+b.col2 from tab1 a JOIN tab2 b ON a.col1=b.col1
insert into tab3(col1,col2)
values(@sum1,@sum2)
set @i=@i+1
END
Best of LucK.........!!