一行拆多行

select a.id, a.username, 
substring_index(substring_index(a.course, '|', b.help_topic_id + 1), '|', -1) course  
from student a JOIN mysql.help_topic b 
ON b.help_topic_id < (length(a.course) - length(REPLACE(a.course, '|', '')) + 1);

猜你喜欢

转载自www.cnblogs.com/douhuan/p/12627778.html