oracle 怎样写sql语句 将同一个ID关联的多个外键用逗号连接成一条数据。

2025-05-09 06:19:38
推荐回答(3个)
回答1:

赞个毛,1楼语法错误,Oracle不支持as写法,应该是 字段名 新名字

回答2:

回答者: badkano - 十四级 2010-9-6 11:07
------------------------------
赞!!!

回答3:

select id,ltrim(sys_connect_by_path(xh,','),',') as xh from (select id,xh,count(*) over(partition by id) cnt from 表名) where level=cnt connect by prior id=id and prior ascii(xh)