开发者社区 问答 正文

mysql分割字符串怎么分呢 百度不行啊

有个表 id和generation_relationship两个字段 id为主键 generation_relationship是主键拼接的字符串 类似 1-2-3

我从百度的方法执行 select substring_index(substring_index(a.generation_relationship,'-',b.help_topic_id+1),'-',-1) from t_newera_customerinfo a join mysql.help_topic b on b.help_topic_id < (length(a.generation_relationship) - length(replace(a.generation_relationship,'-','')) + 1);

结果为空

求帮忙
1-2-3
转成 1 2 3 image.png

展开
收起
社区秘书 2019-11-18 13:58:47 917 分享 版权
1 条回答
写回答
取消 提交回答