General MySQL useful Queries
1. Delete duplicate rows in the table
a. Delete all the duplicate rows
DELETE t1 FROM newuserdata t1 INNER JOIN newuserdata t2 WHERE t1.customproperty1 != t2.customproperty1 AND t1.customproperty2 = t2.customproperty2 AND t1.customproperty3 = t2.customproperty3;
b. Delete duplicate row and keeps the highest customproperty1
DELETE t1 FROM newuserdata t1 INNER JOIN newuserdata t2 WHERE t1.customproperty1 < t2.customproperty1 AND t1.customproperty2 = t2.customproperty2 AND t1.customproperty3 = t2.customproperty3;
The above query also can be used in MODIFYUSERDATAJSON of the HR Connection to delete duplicate user records from the HR import
Comments
Post a Comment