Skip to content

Commit 47a3598

Browse files
authored
Add separate query for MS SQL
1 parent 77946c6 commit 47a3598

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sql-queries-11/delete-identical-rows/using-delete-with-self-join.sql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WHERE
77
DR1.Value3 = DR2.Value3 AND
88
DR1.RecordID > DR2.RecordID;
99

10-
-- MS SQL Server / MySQL
10+
-- MySQL
1111
DELETE FROM DR1
1212
USING DuplicateRecords DR1
1313
JOIN DuplicateRecords DR2 ON
@@ -16,3 +16,11 @@ JOIN DuplicateRecords DR2 ON
1616
DR1.Value3 = DR2.Value3 AND
1717
DR1.RecordID > DR2.RecordID;
1818

19+
-- MS SQL Server
20+
DELETE DR1
21+
FROM DuplicateRecords DR1
22+
JOIN DuplicateRecords DR2
23+
ON DR1.Value1 = DR2.Value1
24+
AND DR1.Value2 = DR2.Value2
25+
AND DR1.Value3 = DR2.Value3
26+
AND DR1.RecordID > DR2.RecordID;

0 commit comments

Comments
 (0)