How to removed duplicate addresses in OwnCloud


Recently, when importing vcards into Owncloud, I ended up with a lot of duplicates. Probably as a result of double clicking or something. I found the following two SQL statements fixed the problem. See original article at https://forum.owncloud.org/viewtopic.php?t=19267. I'm simply posting here in case that article is removed at some point in the future.

DELETE t1 FROM oc_contacts_cards AS t1 JOIN oc_contacts_cards AS t2 ON t1.id>t2.id AND t1.fullname=t2.fullname WHERE t1.fullname != '';
DELETE t1 FROM oc_contacts_cards_properties AS t1 JOIN oc_contacts_cards_properties AS t2 ON t1.id>t2.id AND t1.name=t2.name AND t1.value=t2.value WHERE t1.name != '';

 

Last update:
2015-08-23 23:09
Author:
Rod
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.