Home Page list
Group - Persons with Duplicate Events #namedgroup #events #date #duplicates
- Creates a Named Group in the open database with the name "SQL: Duplicate Events" if one does not already exist
- Deletes all members from that named group
- Populates that named group with persons having "duplicate" events
Duplication is declared if a pair of events:
- (have dates for which the span of calendar years (ignoring month and day) is less than a parameter (2 in the script) OR
- do not have dates but are fact types that use dates) AND
- (are both set or both not set as Primary events)
Duplication is resolved by:
- deleting an event (this may require you to incorporate an alternative date in the date or notes of the remaining event)
- setting one event only of the pair as Primary
To refresh the named group's membership list to reflect corrections you may have made to resolve duplication of events, rerun the query to regenerate the RootsMagic group table and then, in RootsMagic, select a different group and then re-select the "SQL: Duplicate Events" group. You should see that names have disappeared from the group, provided you have corrected all the duplicate events for each person you worked on. The Quick Groups feature in RM7 allows you to unmark a member from the group right from the Edit Person screen making it unnecessary to rerun the script unless you missed doing so.
To vary the parameter controlling how sensitive the query is to date differences, change this line at the end of the script:
WHERE ABS(SUBSTR(Date1,4,4) - SUBSTR(Date2,4,4)) <2 -- this controls how tight the year match must be.
-- in future, the date comparison could call on a date calculator that could compute the difference in days
; --END of SCRIPT
A setting of "<2" permits two consecutive years which allows Dec 31, 1900 and Jan 1, 1901 to be considered duplicates as it does for Jan 1, 1900 and Dec 31, 1901. A setting "<1" requires the events to be in the same year.
Group-PersonsWithDuplicateEvents.sql rev 2018-07-07 bug fixed when no other existing group