日期:2014-05-17 浏览次数:20400 次
--建表
create table #Enterprise (a varchar(20), b varchar(20), c float, d char(1), e datetime)
--写入数据
insert into #Enterprise
select 'Company', 'CN-2811-0911',520.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-2811-0911',520.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-278X-2011',40.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-278X-2011',40.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-267X-1411',52.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-267X-1411',52.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-2186-3011',320.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-2186-3011',320.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-2145-2711',40.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-2145-2711',40.0000,'C','2011-2-20 0:00:00' union all
select 'Company', 'CN-2145-0411',416.0000,null,null
--数据处理
select * into #Temp from #Enterprise group by a,b,c,d,e
--删除表
delete from #Enterprise
--导回数据
insert into #Enterprise
select * from #temp
--原表数据
select * from #Enterprise
------
a b c d e
-------------------- -------------------- ---------------------- ---- -----------------------
Company CN-2145-0411 416 NULL NULL
Company CN-2145-2711 40 C&nb