Deduping Constituents and updating their contact preferences based on attributed date and value

Hi Everyone


I have 20K+ Constituents Records that I would like to dedupe.    I have access to the 'Mass Merge' plugin, this is proving to very time consuming an manual.  Can anyone please suggest a better way?  For Instance I have 2 constituents A & B who are the same person.  I want Constituent A to be the master record as it is older.  But I also want to update the contact permissions if they are later from Constituent B, but not update them if the value is 'Unknown'.  See the example below:
      Constituent B                     Value Added Date     Value Added Date   123456 23/03/2019   Constituent ID 654321 13/02/2020   John Smith 23/03/2019   Name John Smith 13/02/2020   Opt Out 25/05/2019   02. Email Opt In Unknown 18/02/2020   Opt In 13/02/2020   03. SMS Opt In Unknown 23/05/2020   Unknown 09/07/2019   04. Telephone Opt In Opt Out 13/02/2020   Opt In 30/12/2019   05. Post Opt In Opt Out 24/06/2020                                                       Value Added Date           123456 23/03/2019           John Smith 23/03/2019           Opt Out 25/05/2019           Opt In 13/02/2020           Opt Out 13/02/2020           Opt In 24/06/2020                        
Constituent A
 
 
Constituent ID
Name
02. Email Opt In
03. SMS Opt In
04. Telephone Opt In
05. Post Opt In
 
 
Resulting  - Constituent A amended
 
 
Constituent ID
Name
02. Email Opt In
03. SMS Opt In
04. Telephone Opt In
05. Post Opt In
 
Is there a way I which I can do this based on a flat file containing the Constituent I would like to keep, the ones I would like to merge into this and the contact preferences I would like to set,  I would like to do this on mass? As I have confidence already that these are the same people. Currently having to manually specify which of the constituents to keep and then further which contact preferences to keep.  The whole process is extremely time consuming.  Any alternative suggestions are appreciated. 


n.b.  I have access to a copy of the back end of Raiser Edge and thus can pull data out quickly and efficiently via SQL.


Thanks in advanced AJ