1DELETE t1 FROM subscriptions t1
2INNER JOIN subscriptions t2
3WHERE
4 t1.id < t2.id AND
5 t1.user_id = t2.user_id AND t1.name = t2.name
1DELETE FROM table_name WHERE id
2 NOT IN ( SELECT id FROM table_name
3 GROUP BY field_1, field_2)
1DELETE c1 FROM contacts c1
2INNER JOIN contacts c2
3WHERE
4 c1.id > c2.id AND
5 c1.email = c2.email;
1DELETE FROM FriendsData WHERE fID
2 NOT IN ( SELECT fID FROM FriendsData
3 GROUP BY UserID, FriendsUserID, IsSpecial, CreatedBy)
4
1DELETE FROM table_name
2WHERE
3 id IN (
4 SELECT
5 id
6 FROM (
7 SELECT
8 id,
9 ROW_NUMBER() OVER (
10 PARTITION BY field_1
11 ORDER BY field_1) AS row_num
12 FROM
13 table_name
14
15 ) t
16 WHERE row_num > 1
17);
1DELETE FROM NAMES
2 WHERE id NOT IN (SELECT *
3 FROM (SELECT MIN(n.id)
4 FROM NAMES n
5 GROUP BY n.name) x)