DELETE t FROM (SELECT *,ROW_NUMBER()OVER(PARTITION BY test1,test2,test3,test4 ORDER BY RAND()) AS RN FROM TableName) AS t WHERE RN>1
DELETE
t
FROM
(
SELECT
*,ROW_NUMBER()OVER(PARTITION
BY
test1,test2,test3,test4
ORDER
RAND())
AS
RN
TableName)
WHERE
RN>1