Clean up Un-used sources (SQL)
Quote from kevync on 2021-03-18, 9:50 amHi,
is there an SQL that "finds" sources that are not found used anywhere and removes them? Looking for RM8 or one from RM7 that I might be able to adapt.
Alternately, one that at least finds them so I can review.
thanks, Kevin
Hi,
is there an SQL that "finds" sources that are not found used anywhere and removes them? Looking for RM8 or one from RM7 that I might be able to adapt.
Alternately, one that at least finds them so I can review.
thanks, Kevin
Quote from Pat Jones on 2021-03-21, 2:55 amIf you just want sources that don't have citations it would just be a simple select where no citations exist. Source id is still in the main citation table so it's the same for RM7 or 8.
Off the top of my head it's
select * from SourceTable s
left outer join CitationTable c
on s.SourceID = c.SourceID
where c.SourceID is nullIt gets a bit more complicated if you want those that have citations but the citations aren't linked to anything. However that only applies to RM8, since an RM7 citation can't exist without being linked so it's one of those new problems for the future.
If you just want sources that don't have citations it would just be a simple select where no citations exist. Source id is still in the main citation table so it's the same for RM7 or 8.
Off the top of my head it's
select * from SourceTable s
left outer join CitationTable c
on s.SourceID = c.SourceID
where c.SourceID is null
It gets a bit more complicated if you want those that have citations but the citations aren't linked to anything. However that only applies to RM8, since an RM7 citation can't exist without being linked so it's one of those new problems for the future.
Quote from kevync on 2021-03-29, 2:59 pmThanks Pat. Does this new structure potentially have anything to do with the issue of merging duplicate citations and causing issues with GEDCOM etc?
thanks, Kevin
Thanks Pat. Does this new structure potentially have anything to do with the issue of merging duplicate citations and causing issues with GEDCOM etc?
thanks, Kevin