Merge RMA Notes Into One Field

RMA Notes are stored in multiple records in the Windows_Notes table where each note is 75 character long and numerous records (Lines) could be required for a longer note.  So how to you get all the notes into one field to reporting or work with Synergy?

Here is SQL code to concatenate (merge or aggregate) all the notes for one RMA into one field:

SELECT KEY_61 AS RMANUM,
STUFF((SELECT DISTINCT ‘ ‘ + LTRIM(RTRIM(CAST(NOTES_61 as varchar(75))))
FROM Windows_Notes t2
WHERE t2.KEY_61 = t1.KEY_61
FOR XML PATH(”)),1,1,”) AS NOTES
FROM Windows_Notes t1
WHERE TYPE_61 = ‘RM’
GROUP BY KEY_61

Changing the WHERE clause to other records types allows access to the other types of notes stored in the Windows Notes table in MAX for Vendor or Part data.

PlusPoint Bullet