Duplicate Media Tags: Person & Citation

Quote from Jaime Teas on 2022-10-03, 7:38 amI have lots (I mean LOTS) of people who have media that are tagged to both the person and a citation for an event. Is there any way to get rid of the person tags without editing each person and removing them one by one????
I am using RM 7. I've tried the MediaTags-DeletePersonalHavingFactDupes.sql but get zero results.
Thanks so much!
I have lots (I mean LOTS) of people who have media that are tagged to both the person and a citation for an event. Is there any way to get rid of the person tags without editing each person and removing them one by one????
I am using RM 7. I've tried the MediaTags-DeletePersonalHavingFactDupes.sql but get zero results.
Thanks so much!

Quote from Tom Holden on 2022-10-03, 10:32 amUsing SQL, yes. These would be records in the MediaLinkTable which have a common MediaID for OwnerType of 0 and 4. This query should list all such MediaID:
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=0 -- Person
INTERSECT
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=4 --Citation
;Then it's simply a matter of deleting those records having a MediaID in this list and Ownertype=0.
Using SQL, yes. These would be records in the MediaLinkTable which have a common MediaID for OwnerType of 0 and 4. This query should list all such MediaID:
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=0 -- Person
INTERSECT
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=4 --Citation
;
Then it's simply a matter of deleting those records having a MediaID in this list and Ownertype=0.

Quote from Jaime Teas on 2022-10-03, 11:43 amSo I would just save what you sent above as a new sql script and execute it in sqlitespy? or sqlite personal? And how do I delete the records in the list? Where will the list be? Sorry .... I really don't understand sql very well and don't know how to do anything except execute pre-written scripts 🙂 Thanks so very much for your help!
So I would just save what you sent above as a new sql script and execute it in sqlitespy? or sqlite personal? And how do I delete the records in the list? Where will the list be? Sorry .... I really don't understand sql very well and don't know how to do anything except execute pre-written scripts 🙂 Thanks so very much for your help!

Quote from Tom Holden on 2022-10-03, 12:07 pmEither SQLite manager will do. Make sure you have a backup copy of your database in case I've made a mistake or misunderstood.
This script should do it (I've not tested it):
DELETE FROM MediaLinkTable
WHERE OwnerType=0
AND MediaID IN
(
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=0 -- Person
INTERSECT
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=4 --Citation
)
;
Either SQLite manager will do. Make sure you have a backup copy of your database in case I've made a mistake or misunderstood.
This script should do it (I've not tested it):
DELETE FROM MediaLinkTable
WHERE OwnerType=0
AND MediaID IN
(
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=0 -- Person
INTERSECT
SELECT MediaID FROM MediaLinkTable
WHERE OwnerType=4 --Citation
)
;

Quote from Jaime Teas on 2022-10-03, 12:29 pmIt worked beautifully!!!!!!!!!!!!!! Thank you soooo much! Jaime
It worked beautifully!!!!!!!!!!!!!! Thank you soooo much! Jaime