Answers for "mysql delete older duplicates"

SQL
2

mysql remove duplicates

DELETE t1 FROM subscriptions t1
INNER JOIN subscriptions t2 
WHERE 
    t1.id < t2.id AND 
    t1.user_id = t2.user_id AND t1.name = t2.name
Posted by: Guest on June-18-2021
3

mysql remove duplicates

DELETE FROM table_name WHERE id 
       NOT IN ( SELECT id FROM table_name 
                   GROUP BY field_1, field_2)
Posted by: Guest on June-18-2020
4

mysql delete older duplicates

DELETE FROM CONTACTS
WHERE ID NOT IN
      (SELECT *
       FROM (SELECT max(ID)		
             FROM CONTACTS
             GROUP BY EMAIL) t);
 -- ⇓ Test it ⇓ (Fiddle source link)
Posted by: Guest on July-13-2021
0

mysql delete older duplicates

delete test
   from test
  inner join (
     select max(id) as lastId, email
       from test
      group by email
     having count(*) > 1) duplic on duplic.email = test.email
  where test.id < duplic.lastId;
Posted by: Guest on August-17-2020
0

mysql remove duplicates

DELETE t1 FROM contacts t1
INNER JOIN contacts t2 
WHERE 
    t1.id < t2.id AND 
    t1.email = t2.email;Code language: SQL (Structured Query Language) (sql)
Posted by: Guest on February-11-2021

Code answers related to "mysql delete older duplicates"

Code answers related to "SQL"

Browse Popular Code Answers by Language