數據庫表bim_section_management中path中存儲的值為 a.b.c.d 的字符串形式,以 . 分割,實現查詢具體的sql如下:
select
DISTINCT substring_index( substring_index(t1.path,'.',t2.help_topic_id + 1), '.' ,-1 )
from bim_section_management t1 join mysql.help_topic t2 on t2.help_topic_id < (length(t1.path) - length(REPLACE(t1.path,'.','')) + 1 )
如果復用只需要替換加粗部分代碼即可。該方法需要明確a,b,c,d字符長度均相同一致才會分割生效,有一定局限性。