select CITYCATEGORYID=stuff((select ','+CITYCATEGORYID from JXCITYCATEGORY for xml path('')),1,'')
功能1
aa
bb
cc
dd
ee
ff
改成
name
aa,bb,cc,dd,ee,ff
select name=stuff((select ','+name from tb for xml path('')),'')
功能2
select top 3 cityid,citycategoryid from JXCITYCATEGORY
for xml path
<row>
<cityid>60_01</cityid>
<citycategoryid>1_01</citycategoryid>
</row>
<row>
<cityid>60_02</cityid>
<citycategoryid>1_02</citycategoryid>
</row>
<row>
<cityid>60_03</cityid>
<citycategoryid>1_03</citycategoryid>
</row>
功能3