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