经典sql语句

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 )p
where a.nrbh=p.nrbh
 

posted @ 2014-10-31 16:12  向之礼  阅读(167)  评论(0编辑  收藏  举报