日期:2014-05-17 浏览次数:21171 次
create table #Temp
(
id int,
[money] decimal(18,4)
)
insert into #Temp values (1,12)
insert into #Temp values (1,12)
insert into #Temp values (1,12)
insert into #Temp values (1,12)
insert into #Temp values (1,12)
select null [name],null [text],sum(id),null [time] from #Temp
union all
select null [name],null [text],sum([money]),null [time] from #Temp
drop table #Temp
create table #Temp
(
id int,
[name] varchar(20),
[text] varchar(20),
[time] varchar(20),
[money] decimal(18,6)
)
insert into #Temp values (1,'a','b','2013-10-31',10010)
insert into #Temp values (2,'a1','b1','2013-11-01',10012)
select [id], [name], [text],[time] , [money] from #Temp
union all
select null [id],null [name],null [text],null [time],sum([money]) from #Temp
drop table #Temp