我要查找一个集合,单独执行select ''''||replace(Ztdoc,',',''',''')||'''' as urls from sl_hot_sport t where t.Htype='164' and t.id=46,这句会得到'201509/11/121.png','201509/11/add.png','',
如果将这个结果放到语句select e.title, e.fileurl from ss_feature_document e
where e.fileurl in ('201509/11/121.png','201509/11/add.png',''),里是能得到数据的,但是如果这两句结合后。如下
就得不到数据了,
select e.title, e.fileurl from ss_feature_document e
where e.fileurl in (select ''''||replace(Ztdoc,',',''',''')||'''' as urls from sl_hot_sport t where t.Htype='164' and t.id=46)
不过后来论坛中有人帮助这样写,就行了
select e.title, e.fileurl,t.ztitle from sl_hot_sport t left join ss_feature_document e on t.id=e.itemid
where instr((select ''''||replace(Ztdoc,',',''',''')||'''' as urls from sl_hot_sport t where t.Htype='164' and t.id=46) , e.fileurl ) > 0 ;
本文探讨了一个在SQL查询中将复杂URL字符串转换为可匹配形式,并应用于实际查询场景的问题。通过实例展示了如何将自定义的URL转换逻辑整合到SQL语句中,以实现高效的数据匹配。同时,提出了一种替代方案来解决直接嵌入转换函数导致的查询失败问题,并通过实际案例验证了其可行性。
2685

被折叠的 条评论
为什么被折叠?



