mysql中单个字段包含','转换成多条记录

 

 

 问题:把value中的值取出作为另外一个表的where条件时,必须把value中的用','分隔的每一个id截取出来

解决方法:

 

select distinct substring_index(substring_index(a.value,',',b.help_topic_id+1),',',-1)   
from mytest a join  mysql.help_topic b  on b.help_topic_id < (length(a.value) - length(replace(a.value,',',''))+1)
 

 

 

#本文参考自网络某文章,非原创

 

posted @ 2019-10-21 10:13  dingshuai  阅读(687)  评论(0编辑  收藏  举报