select stu.name, sum(k.price)
(select name,
regexp_substr(books, '[^,]+', 1, level) book
--regexp_substr(str,reg,起始位置 第几次)
from students
connect by level <= regexp_count(books, ',') + 1
--regexp_count(teachers, ',') 统计字符串中,的数量
and id = prior id
and prior dbms_random.value is not null) stu
--筛选掉空数据
left join book k on k.code = stu.book
---------------------
作者:晓豆其实不太逗
来源:优快云
原文:https://blog.youkuaiyun.com/weixin_43053679/article/details/82687764
版权声明:本文为博主原创文章,转载请附上博文链接!
oracle的单行转多列
最新推荐文章于 2024-08-26 15:53:21 发布