+ 3

Remove duplicate rows in SQL

how to remove/delete the duplicate rows in a table using SQL.

11th Aug 2017, 4:28 PM
Sridhar
Sridhar - avatar
3 ответов
+ 2
Use DISTINCT keyword for this
11th Aug 2017, 6:40 PM
Roman
Roman - avatar
+ 1
https://stackoverflow.com/questions/18932/how-can-i-remove-duplicate-rows DELETE FROM MyTable LEFT OUTER JOIN ( SELECT MIN(RowId) as RowId, Col1, Col2, Col3 FROM MyTable GROUP BY Col1, Col2, Col3 ) as KeepRows ON MyTable.RowId = KeepRows.RowId WHERE KeepRows.RowId IS NULL
13th Aug 2017, 2:11 PM
Roman
Roman - avatar
0
what if we have to delete the row permanently from database
13th Aug 2017, 1:18 PM
Sridhar
Sridhar - avatar