select substr(max(sys_connect_by_path(字段1,',')),2) result from (select 字段1,row_number()over(order by 字段1) xh from 表1) start with xh=1 connect by prior xh=xh-1用sys_connect_by_path就可以搞定,哈哈
要oracle 9i开始才有,9i以下怎么办?
select substr(max(sys_connect_by_path(id, ',')), 2) from (select t.id, t.id - 1 rk from 表1 t) start with rk = 0 connect by rk = prior id
(select 字段1,row_number()over(order by 字段1) xh from 表1)
start with xh=1 connect by prior xh=xh-1用sys_connect_by_path就可以搞定,哈哈
from (select t.id, t.id - 1 rk from 表1 t)
start with rk = 0
connect by rk = prior id