id    name
1      a
2      就
3      是
4      嗯
5      cc
6      dd拼接结果为:
a,就,是,嗯,cc,dd
用逗号拼接起来

解决方案 »

  1.   

    找到了一条,想看看有没有更简单的剪短的sql语句。。
      

  2.   

    select wmsys.wm_concat(name) from table_name
      

  3.   


    with t as (
    select 1 as ismaster,'qingyun' as uname,'租赁' as state from dual union all
    select 0 as ismaster,'aa' as uname,'租赁' as staet from dual union all
    select 0 as ismaster,'aa' as uname,'空闲' as staet from dual
    )
    select wmsys.wm_concat(uname) from (select * from t where state='租赁' order by ismaster desc)
      

  4.   

    wmsys.wm_concat()拼接字段 以逗号分开 
      

  5.   

    WITH t AS(
    SELECT 1 id,'a' NAME FROM dual
    UNION ALL 
    SELECT 2,'就' FROM dual
    UNION ALL 
    SELECT 2,'是' FROM dual
    UNION ALL 
    SELECT 2,'嗯' FROM dual
    UNION ALL 
    SELECT 2,'cc' FROM dual
    UNION ALL 
    SELECT 2,'dd' FROM dual)
    SELECT wm_concat(name) FROM t