create table lin_test(no int,num int) insert into lin_test select 1,100 union all select 1,100 union all select 2,100 union all select 3,500 union all select 4,300 select no,sum(num) num into # from lin_test group by no select * from #go drop table lin_test
insert into lin_test select 1,100
union all select 1,100
union all select 2,100
union all select 3,500
union all select 4,300
select no,sum(num) num into # from lin_test group by no
select * from #go
drop table lin_test