溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

mysql分號分割開字段。拆分

發(fā)布時間:2020-07-10 11:12:05 來源:網(wǎng)絡(luò) 閱讀:1477 作者:寒月谷 欄目:MySQL數(shù)據(jù)庫

問題-: mysql如何進(jìn)行以,分割的字符串的拆分
分割開逗號 分號的字段。其他字段自動補(bǔ)齊。

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 );

實現(xiàn)出來的效果。 :

mysql分號分割開字段。拆分

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI