代码
with
t
as
(
select
1
id,
'
Child1
'
child
union
select
1
id,
'
Child2
'
union
select
1
id,
'
Child3
'
union
select
2
id,
'
Child1
'
union
select
2
id,
'
Child2
'
)
select
id,
stuff
((
select
'
,
'
+
child
from
t a
where
b.id
=
a.id
for
xml path(
''
)),
1
,
1
,
''
) children
from
t b
group
by
id
转载于:https://www.cnblogs.com/lfzwenzhu/archive/2010/08/20/1804404.html
转载请注明原文地址: https://win8.8miu.com/read-1558864.html