步骤一:将使用group_concat得到的输出结果导入:
load data infile 'D:/test/output_4_9.txt'
into table test_111
fields terminated by '\t'
into table test_111
fields terminated by '\t'
注意这里文件名路径:只能使用英文,我使用D:\提交\output.txt 就不行;
select a.user_id,substring_index(substring_index(a.brand_id,',',b.help_topic_id+1),',',-1) as band_id
from
test_111 a
join
mysql.help_topic b
on b.help_topic_id < (length(a.brand_id) - length(replace(a.brand_id,',',''))+1)
order by a.user_id;
PS: 这里mysql.help_topic是mysql自己的数据库