Skip to content

Instantly share code, notes, and snippets.

@Loupax
Created May 27, 2016 07:50
Show Gist options
  • Select an option

  • Save Loupax/caba100299a4837e4de93b19916380b7 to your computer and use it in GitHub Desktop.

Select an option

Save Loupax/caba100299a4837e4de93b19916380b7 to your computer and use it in GitHub Desktop.
DELETE cu1 FROM db.client_users cu1, db.client_users cu2
WHERE cu1.id > cu2.id
AND cu1.client_user_id = cu2.client_user_id
AND cu1.client_id = cu2.client_id
AND cu1.owner_type = cu2.owner_type
AND cu1.id <> cu2.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment