merging in bulk

Hi everyone,

We are doing some database cleanup and I have a very long list of constituent ids that need to be merged into one keep id (old tnew guest checkout records with no identifying info on them).  I know I can inactivate all of these records,but people would rather they be merged.  Has anyone done a bulk merge in SQL?  I'm having some trouble when I test it out in Test, and if anyone was willing to share some code, I would be eternally grateful.  (we're on 15.0.3).

thanks,
Kathleen