update hn_spsc_xcnrb set nrmc =p.info from hn_spsc_xcnrb a,(select nrbh,STUFF((SELECT ','+mxmc from hn_spsc_xcnrmxb t2 WHERE t1.nrbh=t2.nrbh FOR XML PATH('')) ,1,1,'')info from hn_spsc_xcnrmxb t1 GROUP by nrbh )pwhere a.nrbh=p.nrbh