Futa Safu Nakala katika MySQL- Futa safu mlalo nakala kwa kutumia taarifa ya DELETE JOIN

Ungependa kufuta Safu Nakala zote isipokuwa Moja kwenye MySQL? [rudufu]

Jedwali la mtumiaji lina rekodi 5 zilizo na nakala ya barua pepe ya [email protected]

Utafutaji hurejesha nakala za barua pepe kwenye jedwali la Watumiaji:

SELECT *, COUNT(email) FROM users  
GROUP BY email   
HAVING  COUNT(email) > 1;

Futa nakala za safu mlalo kwa kutumia taarifa ya DELETE JOIN

DELETE table1 FROM users table1  
	INNER JOIN users table2   
	WHERE table1.id < table2.id AND table1.email = table2.email

Matokeo