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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM