mysql同事包含_mysql 包含关系处理
生活随笔
收集整理的這篇文章主要介紹了
mysql同事包含_mysql 包含关系处理
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
情景:
T1
主鍵 idstr
A 1,4,2,5
B 2,4,6,5,3
C 3,11,4,5,6
當
idstr=1,4 結果 A
idstr=6,5,3 結果 B,C
結果:
select a.id from (
select a.ID,substring_index(substring_index(a.idstr,',',b.help_topic_id+1),',',-1) as idstra
from
report_test a
join
mysql.help_topic b
on b.help_topic_id < (length(a.idstr) - length(replace(a.idstr,',',''))+1)
order by a.ID) a where instr(a.idstra,'1,4') group by a.id having count(1)>(length('1,4') - length(replace('1,4',',','')))
總結
以上是生活随笔為你收集整理的mysql同事包含_mysql 包含关系处理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql修改校对集_MySQL 教程之
- 下一篇: 2022-2028年中国石化行业节能减排