We need to combine 3 columns in a database by concatenation. However, the 3 columns may contain overlapping parts and the parts should not be duplicated. For example,
This problem seems like a variation of the longest common sub-sequence problem, which can be solved via dynamic programming.
http://www.algorithmist.com/index.php/Longest_Common_Subsequence