求一个视图!

lrq182 2009-08-24 03:51:04
有这样一张表
id type name
1 音乐 1.MP3
2 音乐 2.MP3
3 诗歌 aa.mp3
4 诗歌 bb.mp3

求一个视图,能将这些数据,按这样的方法输出!
type name
音乐 1.mp3|2.mp3
诗歌 aa.mp3|bb.mp3
...全文
30 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
小灰狼W 2009-08-24
  • 打赏
  • 举报
回复
select type,Substr(Max(Sys_Connect_By_Path(name, '|')), 2) name
from (select t.*,row_number()over(partition by type order by id)rn from tab1 t)
start with rn=1
connect by rn-1=prior rn
and type=prior type
group by type

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧