Home > database >  deleting duplicates in the mysql database
deleting duplicates in the mysql database

Time:12-05

I recently created a database for myself and I have a problem looking for duplicates. My point is that a given number in the database does not appear 2 times and I would like to detect something like that with a command. for now I have something like this but unfortunately it does not work. I would like several tables to be searched because the numbers will be entered into each of them. i created database in mysql

DELETE a FROM `SomeoneA` AND 'SomeoneB' AS a INNER JOIN `SomeoneA` AND 'SomeoneB' AS b WHERE a.number < b.number AND a.id = b.id

CodePudding user response:

Your delete join syntax is slightly off:

DELETE a
FROM SomeoneA AS a
INNER JOIN SomeoneB AS b
    ON a.id = b.id
WHERE a.number < b.number;
  • Related