問題-: mysql如何進行以,分割的字符串的拆分
分割開逗號 分號的字段。其他字段自動補齊。
https://blog.csdn.net/u012009613/article/details/52770567
SELECT s.* from (
SELECT t.ID,t.time_old,
substring_index( substring_index( t.all_content, ';', b.help_topic_id + 1 ), ';', -1 ) content_split
-- t.*
FROM
excel_lvli t
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( t.all_content ) - LENGTH( REPLACE ( t.all_content, ';', '' ) ) + 1 )
and t.all_content like '%;%'
and t.all_content like '%畫了許多%'
) s
WHERE LENGTH(s.content_split) >0 ;
SELECT
substring_index( substring_index( t.context, ',', b.help_topic_id + 1 ), ',', - 1 )
FROM
test.test t
JOIN mysql.help_topic b ON b.help_topic_id < ( LENGTH( t.context ) - LENGTH( REPLACE ( t.context, ',', '' ) ) + 1 );
實現出來的效果。 :