日期:2014-05-17 浏览次数:20627 次
;
WITH huang
AS ( SELECT s.sindex ,
sname ,
t.tindex ,
t.tname
FROM S
INNER JOIN sc ON s.sindex = sc.sindex
INNER JOIN t ON sc.tindex = t.tindex
)
SELECT a.sindex ,
a.sname ,
STUFF(( SELECT ',' + tindex
FROM huang b
WHERE b.sindex = a.sindex
AND b.sname = a.sname
FOR
XML&