如何把一张表中相同的数据完全删除,保留没有重复的?
如题,
马上结贴
[解决办法]
create table #tmpTable(
...............
)
insert into #tmpTable(....) select distinct * from 你的表 -- 找出不重复的记录
delete from 你的表
insert 你的表 select #tmpTable
[解决办法]
http://community.csdn.net/Expert/topic/4738/4738306.xml?temp=.8555719
[解决办法]
create trigger a on 表
for delete
as
insert into t1 select top 1 * from deleted
go
delete from t1 where 字段 in (select 字段 from t1 group by 所有字段 having count(*)> 1) and 字段 in (select 字段 from t1 group by 所有字段 having count(*)> 1)...所有的字段
[解决办法]
delete ta
where binary_checksum(*) in(select binary_checksum(*) from ta group by binary_checksum(*) having count(*)> 1)
[解决办法]
binary_checksum(*)--*号为所有列重复值,可指定列名(A列、B列....)有重复值