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

Popular posts from this blog

How to update Endpoint(Account) Custom property labels in Saviynt

Updating User custom property labels in Saviynt

Exchange Integration using REST Connector in Saviynt