ORACLE逗号分隔的字符串字段,关联表查询

使用场景如下:

oracle12 以前的写法:

sql 复制代码
select
    t.pro_ids,
    wm_concat(t1.name) pro_names
from info t,product t1
where instr(','||t.pro_ids|| ',',','|| t1.id|| ',') > 0
group by pro_ids

oracle12 以后的写法:

sql 复制代码
select
    t.pro_ids,
    listagg(DISTINCT t1.name,',') pro_names
from info t,product t1
where instr(','||t.pro_ids|| ',',','|| t1.id|| ',') > 0
group by pro_ids

参考原文:https://blog.csdn.net/x1107761900/article/details/88972610

https://blog.csdn.net/AlbenXie/article/details/102698460

相关推荐
Y***K43412 分钟前
MySQL网站
数据库·mysql
q***448116 分钟前
postgresql链接详解
数据库·postgresql
菜鸟‍30 分钟前
【后端学习】MySQL数据库
数据库·后端·学习·mysql
污斑兔37 分钟前
腾讯云 CloudBase 数据库 CRUD 完整指南
数据库·云计算·腾讯云
tuokuac1 小时前
批量新增操作为什么要加@Transactional注解
数据库
q***9943 小时前
Redis的Spring配置
数据库·redis·spring
S***y3963 小时前
MySQL视频
数据库·mysql
周杰伦fans4 小时前
[特殊字符] 代理模式超详细讲解 ——.NET
数据库·c#·代理模式
YJlio4 小时前
「C++ 40 周年」:从“野蛮生长的指针地狱”到 AI 时代的系统底座
c++·人工智能·oracle
TDengine (老段)4 小时前
TDengine 转换函数 TO_JSON 用户手册
android·大数据·数据库·json·时序数据库·tdengine·涛思数据