delete duplication record in sql server
DELETE
FROM MyTable
WHERE ID NOT IN
(SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicatevalueColumn1, DuplicateValueColumn2, DuplicateValueColumn2[@more@]
FROM MyTable
WHERE ID NOT IN
(SELECT MAX(ID)
FROM MyTable
GROUP BY DuplicatevalueColumn1, DuplicateValueColumn2, DuplicateValueColumn2[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2334/viewspace-995621/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Sql Server系列:Delete語句SQLServerdelete
- SQL Server中的IO效能殺手Forwarded recordSQLServerForward
- Delete大量資料後SQL Server效能下降deleteSQLServer
- sql server 帶有OUTPUT的INSERT,DELETE,UPDATESQLServerdelete
- pl/sql record 詳解SQL
- SQL__DELETESQLdelete
- sql server 2005下奇怪的Delete Top 語句(downmoon)SQLServerdelete
- 【SQL】11 SQL DELETE 語句SQLdelete
- SQL Server的Merge —— 一步實現 insert,update,deleteSQLServerdelete
- SQL – TRUNCATE vs DELETESQLdelete
- 【SQL Server學習筆記】Delete 語句、Output 子句、Merge語句SQLServer筆記delete
- 237. Delete Node in a Linked List--LeetCode RecorddeleteLeetCode
- Oracle Active database duplicationOracleDatabase
- SQL truncate 、delete與drop區別SQLdelete
- sql:delete if exists還是drop if exists?SQLdelete
- SQL in ORACLE and SQL ServerSQLOracleServer
- sql ServerSQLServer
- SQL Server連線SQL Server、SQL Server連線ORACLE 連結伺服器SQLServerOracle伺服器
- delete相關的pl/sql調優deleteSQL
- 記錄Record、PL/SQL表和二維陣列SQL陣列
- SQL Server 2008中SQL增強之三:Merge(在一條語句中使用Insert,Update,Delete)SQLServerdelete
- SQL Server常用工具——SQL Server Powershell ExtensionsSQLServer
- sql server with ...as 用法SQLServer
- SQL Server raiserrorSQLServerAIError
- SQL Server 鎖SQLServer
- SQL Server OptimizationSQLServer
- SQL SERVER 版本SQLServer
- SQL Server AttentionSQLServer
- sql server 使用SQLServer
- SQL Server教程SQLServer
- Moebius for SQL ServerSQLServer
- sql server agent與sql server有什麼區別 ?SQLServer
- SQL Server Express和SQL Server Compact的應用SQLServerExpress
- SQL SERVER中SQL優化SQLServer優化
- SQL Deverlop連線SQL ServerSQLdevServer
- SQL Server 之 SQL 注入篇SQLServer
- 11g 新特性—— Active Database DuplicationDatabase
- 【SQL Server】--SQL Server資料庫bak檔案還原SQLServer資料庫