select * into TempTable from yourtable where 1=2 insert into TempTable select distinct * from yourtable truncate table yourtable insert into yourtable select * from Temptable drop table Temptable
不对不对 上边UPDATE应改为 INSERT TO TABLE FROM TABLE1
acjin的对,提醒我INSERT用法: INSERT x SELECT INTO Y 语句忽略表 Y,并且将 SELECT 结果插入表 X 中, 如下所示: INSERT X SELECT select_list INTO Y
select distinct * from table1 into #temp drop table table1 select * into table1 from #temp drop table #temp
Delete From table1 a Where a.rowid != (Select max(rowid) from table1 b where a.col1 = b.col1 and a.col2 = b.col2 and ...);
除了删除再添加还没发现更好的办法
delete from table
update
set table.*=table1.*
from table1
drop table1
欢迎来讨论
insert into TempTable select distinct * from yourtable
truncate table yourtable
insert into yourtable select * from Temptable
drop table Temptable
上边UPDATE应改为
INSERT TO TABLE FROM TABLE1
INSERT x SELECT INTO Y
语句忽略表 Y,并且将 SELECT 结果插入表 X 中,
如下所示:
INSERT X
SELECT select_list INTO Y
drop table table1
select * into table1 from #temp
drop table #temp