步骤一:将使用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自己的数据库
本文介绍了如何使用SQL语句进行数据导入及处理的具体方法,包括通过load data infile导入数据到指定表中,并注意文件路径的正确设置。此外,还详细讲解了如何创建新表并利用group_concat进行数据处理。

1606

被折叠的 条评论
为什么被折叠?



