sql 同一字段合并

select a.* from (select id,Detail,partId=(select cast(partId as char(36))+',' from (select * from table) as b where b.id=a.id for xml path(''))

,code

from table a

group by id,Detail,code) a

posted @ 2017-06-06 17:31  chang1234  阅读(1084)  评论(0编辑  收藏  举报