sqlserver 去除重复的行数据

利用 distinct 关键字过滤重复的行,将查询的结果写入临时表

select distinct * into #temp from  mytable 

删除原表的数据
delete mytable

将临时表插入到表中
insert mytable select * from #temp

释放临时表
drop table #temp

删除数据行是NULL的
delete from mytable where time is null

update table set [coulms]='new-values' where [coulms]='values' and year(备份时间)=2019 and Month(备份时间)=11 and DAY(备份时间)=13

posted @ 2019-10-30 16:00  笑傲运维  阅读(1289)  评论(0编辑  收藏  举报