日期:2014-05-16  浏览次数:21077 次

sql高手请进来,请问如何将查询的一列数据拼接用逗号隔开显示成一条记录?
请问如何将查询的一列数据拼接用逗号隔开显示成一条记录?

------解决方案--------------------
SQL code

WITH t AS
(
SELECT 1322049461 a FROM dual
UNION ALL
SELECT  1322041123    FROM dual
UNION ALL
SELECT  1322049461 FROM dual
)
--9i
SELECT max(substr(sys_connect_by_path(a,','),2)) b
FROM 
       (SELECT a,row_number() over(ORDER by a) rn FROM t)
 START WITH rn=1 CONNECT BY rn-1=PRIOR rn

--10g
select wm_concat(a,',') from t