Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Co-Related sub query
create table #tmp(roleid int,comid varchar) insert into #tmp values(1,'A'),(1,'B'),(2,'C'),(2,'D') select * from #tmp SELECT roleid, comid= STUFF((SELECT ', ' + comid FROM #tmp r where r.roleid=t.roleid FOR XML PATH('')), 1, 2, '') FROM #tmp t GROUP BY roleid SELECT ', ' + comid FROM #tmp r FOR XML PATH('') drop table #tmp
run
|
edit
|
history
|
help
0
QLSV
FIGURA5.4
1
Branch
1
top 3 salaries from each dept
aaa
sql-server-storing-wildcards-in-data
math function
prince46