------解决方案-------------------- select ORGID,wm_concat(NAME) from tlb
group by ORGID
oracle写法 ------解决方案--------------------
--select 'a' NAME, 1 ROWNO, 1 ORGID
--into #t
--union all select 'b', 2 ,1
--union all select 'c', 3 ,1
--union all select 'asdf', 1 ,2
--union all select '12334', 1 ,3
select stuff(
(select ','+name
from #t b
where a.ORGID=b.ORGID for xml path(''))
,1
,1
,'') as NAME
,min(ROWNO) as ROWNO
,ORGID
from #t a
group by ORGID