4,818
社区成员
发帖
与我相关
我的任务
分享
declare @tb as table (
name nvarchar(20),
adress nvarchar(20),
tel varchar(20),
email varchar(50)
)
insert into @tb
select N'李四',N'西安',N'23456',N'lisi@163.com' union all
select N'张三',N'武汉',N'123456',N'iloveyou@163.com' union all
select N'张三',N'武汉',N'123456',N'iloveyou@163.com' union all
select N'王五',N'南京',N'34534',N'123@132.com' union all
select N'王五',N'南京',N'34534',N'123@132.com' union all
select N'王麻子',N'重庆',N'134345',N'125@163.com'
select * from @tb
---方法一 使用臨時表
select distinct * into #tb from @tb
delete @tb
insert into @tb select * from #tb
select * from @tb
drop table #tb
