mysql把一字段拆分为多行

一:数据库


二:sql语句

select a.house_no as '房子',substring_index(substring_index(a.name,',',b.help_topic_id+1),',',-1) as '拥有者' 
from  aa a
join   mysql.help_topic b on b.help_topic_id < (length(a.name) - length(replace(a.name,',',''))+1);

三:查询结果


猜你喜欢

转载自blog.csdn.net/m0_37934074/article/details/78784172