Reputation: 131
So, I have 2 fields, Other_EEs
, and Other_EE_Names
from the same table. I want to merge both into one existing field in another table without any interruption. Both contain a bit of info. So far I merged those two fields separately but the second one overrides the first one. How can I merge two fields at the same time? Here's what I'm using so far. Thanks!
UPDATE MI
SET MI.M_Reps_Contact_Info = M.Other_EE_Names + ' '+ M.Other_EEs +
COALESCE( MI.M_Reps_Contact_Info +
CHAR(13) + CHAR(10), '' )
FROM dbo.suptbl_Sprint2_Interview AS M
INNER JOIN dbo.suptbl_Sprint2_MgrInterview AS MI
ON M.Junction_ID = MI.Junction_ID`
Upvotes: 0
Views: 2439
Reputation: 1269703
If the second one "overrides" the first, then I am guessing that the values can be NULL.
Try this set
statement:
SET MI.M_Reps_Contact_Info = COALESCE(M.Other_EE_Names + ' ', '') +
COALESCE(M.Other_EEs, '') +
COALESCE(MI.M_Reps_Contact_Info +
CHAR(13) + CHAR(10), '' )
Upvotes: 1